Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So I have an engine (air application) that basically (for now) is loading some windows on the screen/stage, and you can drag them around. And later on, I'll be able to add other objects onto the stage.

How would I export any kind of information (like co-ordinates or sizes of windows) out of my application to an external custom file. And then I would use that file to reload a previous project if I were to re-load the engine.

I'm working in AS3/Air and in FlashDevelop.

Thanks for the help and time. If anymore information is needed please let me know.

Cheers.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

since you're creating the windows and have the drag / sizing information do you not already have the x,y, width, height information?

for saving files, AIR will allow you to do this without user prompting (what it sounds like your after) through the flash.filesystem. The AS3 should be something like the following (not tested)

import flash.filesystem.*;  
import flash.events.Event;  

private function saveFile():void{  
    var file:File = File.desktopDirectory; // change to suit your needs  
    file= file.resolvePath("example.txt");  
    var fileStream:FileStream = new FileStream();  
    fileStream.openAsync(file, FileMode.WRITE);  
    fileStream.writeUTFBytes("Saved content!!!"); // change this for the data you want   
    fileStream.addEventListener(Event.CLOSE, fileClosed);  
    fileStream.close();  
}

function fileClosed(event:Event):void {  
   trace("closed file event!");  
}        

Hope that helps ;-)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.