Solved

simple file handling in flex/air/as3 flash builder

Posted on 2011-03-13
7
1,132 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reduce the size of the Flash SWF file it executes 12 417
Adobe flash player memory exhaustion 6 91
Adobe Flash player - Microsoft Edge 9 158
embedding a media live encoder stream 3 119
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now