Solved

simple file handling in flex/air/as3 flash builder

Posted on 2011-03-13
7
1,149 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
video live streaming 1 128
Web browser crash when play videos 24 445
PDF: Display my cards game? 8 152
CD Rom not playing 13 83
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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.

742 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