Solved

simple file handling in flex/air/as3 flash builder

Posted on 2011-03-13
7
1,123 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
Comment Utility
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
Comment Utility
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
Comment Utility
Are you using a MAC or PC?

Warm Regards
Deepanjan Das
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:C_Schlottfeldt
Comment Utility
PC
0
 
LVL 17

Accepted Solution

by:
deepanjandas earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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 which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

762 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

6 Experts available now in Live!

Get 1:1 Help Now