Save remote rss on desktop in Air AS3


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import flash.filesystem.File;
  2. import flash.filesystem.FileMode;
  3. import flash.filesystem.FileStream;
  4.  
  5. var file:File = File.desktopDirectory.resolvePath( "file.txt" );
  6. var stream:FileStream = new FileStream();
  7. var xmlLoader:URLLoader = new URLLoader();
  8.  
  9. xmlLoader.addEventListener(Event.COMPLETE, onLoaded);
  10.  
  11. function onLoaded(e:Event):void {
  12. stream.open( file, FileMode.WRITE );
  13. stream.writeUTFBytes(e.target.data);
  14. stream.close();
  15. file = null;
  16. stream = null;
  17. }
  18.  
  19. xmlLoader.load(new URLRequest("http://www.yourfeedurl.com/file.xml"));

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.