Then 'f' is the reference to the playlist.pls right? That one i can than pass through to my PLS reader?

This really helped me alot!
May I refer you to this image: 
http://www.aperturaphoto.com/blog/wp-content/uploads/2008/03/you-rock-you-rule.bmp

Thanks!
Sid

On Apr 22, 2009, at 5:25 PM, Muzak wrote:

Well that was just an example :)

Here's how to do it without the save file dialog:

 private function plsLoaded(evt:Event):void {
  trace("Application ::: plsLoaded");
  var value:String = evt.currentTarget.data;
  trace(value);
   var f:File = File.applicationStorageDirectory;
  f.url += "/playlist.pls";
  trace("    - url: ", f.url);
  trace("    - nativePath: ", f.nativePath);
  var fs:FileStream = new FileStream();
  fs.open(f, FileMode.WRITE);
  fs.writeUTFBytes(plsData);
  fs.close();
 }

The above will create a file called "playlist.pls" on your desktop.

Some stuff on security:
http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7e5b.html
http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7e59.html

From the above:
<quote>
AIR applications cannot modify content using the app: URL scheme.
Also, the application directory may be read only because of administrator settings.

Unless there are administrator restrictions to the user's computer, AIR applications are privileged to write to any location on the user's hard drive. Developers are advised to use the app-storage:/ path for local storage related to their application.
</quote>

To get to the application storage directory rather than the desktop, in the above example, use:
  var f:File = File.applicationStorageDirectory;

regards,
Muzak

----- Original Message ----- From: "Sidney de Koning" <sid...@funky-monkey.nl >
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, April 22, 2009 3:37 PM
Subject: Re: [Flashcoders] Loading string data in a file from a server


Hi Muzak,

This is not exactly what i want to do but it comes close (and i cant test right now since i'm at work) The whole 'prompt user for saving a file' i want to avoid, but the below code looks like what i wan to do:

 var f:File = evt.currentTarget as File;
 trace("    - nativePath: ", f.nativePath);
 // create filestream, open it and write data to file
 var fs:FileStream = new FileStream();
 fs.open(f, FileMode.WRITE);
 fs.writeUTFBytes(plsData);
 fs.close();

Thanks for the help, will let you know if it worked.

Sid



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Sidney de Koning - be a geek, in rockstar style!
Flash / AIR Developer @ www.funky-monkey.nl
Technical Writer @ www.insideria.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to