1

I want to have a xml file for my configuration and so i have to load it from the same directory the swf file lies in and save it afterwards. I saw articles about filestreams in flex but my compiler didn't allow me to use the filestream. I use the open source flex sdk.

anyone got an idea?

thanks in advance

Sebastian

0

3 Answers 3

1

FileStream is available in Adobe AIR, not in Flex. You can't use files in Flex directly - for security reasons, you don't have access to local files (where the Flash Player is running). You'll need to fetch the data using an HTTP request.

Update: You can read the configuration using an HTTP request - if you want to save information back into the configuration, you'll have to send an HTTP POST with your changes, and have server-side logic update the configuration.

Sign up to request clarification or add additional context in comments.

1 Comment

yes local files do not interest me I need the files on server, by a http request I can't save them, am I right?
0

Saving and file-specific operations are generally done using Java as the backend. BlazeDS is a tool that allows you to "connect" Flex with Java and vice-versa, to make them work together more efficiently (Remoting).

Comments

0

Use URLLoader to load the xml. And URLLoader + PHP/ASP/whatever at the server to save it back:

var loader = new URLLoader();  
loader.addEventListener(Event.COMPLETE, onLoad);  
loader.load(new URLRequest("file.xml");  

var uploader = new URLLoader();  
var data:URLVariables = new URLVariables();  
data.xml = xml.toXMLString();  
var req:URLRequest = new URLRequest("saveXml.php");
req.data = data;  
uploader.load(req);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.