Solved

simple file handling in flex/air/as3 flash builder

Posted on 2011-03-13
7
1,142 Views
Last Modified: 2012-06-27
Hi,

I think it is rather an stupid question but I need help to figure out how does flex/air handles storage directories. I have a sintax like this that will handle a xml file in future :

public var file3:File = File.applicationStorageDirectory;
.....
file3 = file3.resolvePath("data/model.xml");


The thing is:
1 - file3 is a configuration file that will be read and updated during runtime, and I don´t know where to put the "data/model.xml" so that the project will be compiled right and installed correctly in the applications folder of another person´s computer.

2 - Can I use flash builder package explorer (the box in the left side of coding area) to handle these kind of file (considering that the file is loaded through that syntax above)?

Thanks in advance.
0
Comment
Question by:C_Schlottfeldt
  • 3
  • 3
7 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35125496
applicationStorageDirectory denotes the following location:

In Mac
/Users/user name/Library/Preferences/applicationID.publisherID/Local Store/

In PC
user name/Application Data/applicationID.publisherID/Local Store/

Package explorer will not give you access to the above location.

Warm Regards
Deepanjan Das
0
 

Author Comment

by:C_Schlottfeldt
ID: 35125590
Thank you for the answer deepanjandas, but I still don´t know where to store the existing "data/model.xml" in order to compile the program. Do I have to create manualy a "user name/Application Data/applicationID.publisherID/Local Store/" and copy the file there?
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35125617
Are you using a MAC or PC?

Warm Regards
Deepanjan Das
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:C_Schlottfeldt
ID: 35125705
PC
0
 
LVL 17

Accepted Solution

by:
deepanjandas earned 125 total points
ID: 35125809
Okie, go to C:\Documents and Settings
Then browse for the folder with your machine name.

In my case it will be :
C:\Documents and Settings\deepanjandas

Then go to Application Data directory:
C:\Documents and Settings\deepanjandas\Application Data

Remember to check the hidden files to be viewable.

Then create a directory there with the name of your AIR application. This you will get from the <Application name>-app.xml in project src folder. Open this xml to find the name under id tag.

For example say the id tag is like this:
<id>com.deepanjandas.enterprisesystem</id>
So create a folder with the name com.deepanjandas.enterprisesystem.Application

Then within that folder create another folder named "Local Store".

It is within this that you need to keep your files.

But I wonder why you need to keep it manually. You should be writing the files to this directory using code and not manually.

Warm Regards
Deepanjan Das


0
 
LVL 20

Assisted Solution

by:ChristoferDutz
ChristoferDutz earned 125 total points
ID: 35126688
How about embedding a default config in your code and as soon as you start your application you check if there is a file at "data/model.xml" and if it's not then you write your default config to that location and then you're sure that it's where it's supposed to be?

You can embed the default XML by using something like this: http://dispatchevent.org/roger/embed-almost-anything-in-your-swf/
0
 

Author Closing Comment

by:C_Schlottfeldt
ID: 35129132
In fact deepanjandas, i see now that the code should handle the files. Until your post I wasnt aware that I had to hard code the installation file and directory, I thought that Flex would handle it for me automatically. Thanks for the patience!

ChristoferDutz, in fact thats a great reference that gave me alot of insights. THanks alot!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Begin mp4 video on first frame 6 179
Download Adobe Flash Player 6 67
Animating text  - electrons orbit around letter M 12 87
File conversion question 5 118
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question