?
Solved

simple file handling in flex/air/as3 flash builder

Posted on 2011-03-13
7
Medium Priority
?
1,161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:C_Schlottfeldt
ID: 35125705
PC
0
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

765 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