Posted By

rrkrishrr on 11/27/13


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

thastyle


as3 air for android copy application files into android sdcard


 / Published in: ActionScript 3
 

as3 air for android copy application files into android sdcard

  1. import flash.events.MouseEvent;
  2. import flash.filesystem.FileStream;
  3. import flash.filesystem.File;
  4. import flash.filesystem.FileMode;
  5.  
  6. mcBtn.useHandCursor =true;
  7. mcBtn.buttonMode = true;
  8. mcBtn.addEventListener(MouseEvent.CLICK,create);
  9. out.text="not created";
  10.  
  11. function create(e:MouseEvent){
  12. var source:File = File.applicationDirectory.resolvePath("samples");
  13. var destination:File = File.documentsDirectory.resolvePath("samples");
  14. if (!destination.exists) {
  15. workDirectory.createDirectory();
  16. out.text="created"
  17. }
  18. else{
  19. out.text="exist"
  20. copyInto(source,destination);
  21. }
  22.  
  23. }
  24.  
  25. function copyInto(directoryToCopy:File, locationCopyingTo:File):void
  26. {
  27. var directory:Array = directoryToCopy.getDirectoryListing();
  28. for each (var f:File in directory)
  29. {
  30. if (f.isDirectory)
  31. copyInto(f, locationCopyingTo.resolvePath(f.name));
  32. else
  33. f.copyTo(locationCopyingTo.resolvePath(f.name), true);
  34. }
  35. }

Report this snippet  

You need to login to post a comment.