Posted By

martin9999uk on 05/25/11


Tagged

path as3 loaderURL


Versions (?)

Path to swf folder in AS3


 / Published in: ActionScript 3
 

  1. You can use loaderInfo.loaderURL to get the full path and name of you swf
  2.  
  3. Example of a class:
  4.  
  5. public class Main extends Sprite {
  6. private function init():void {
  7. removeEventListener(Event.COMPLETE, init);
  8. var myUrl:String=loaderInfo.loaderURL;
  9. var tmp:Array=myUrl.split("/");
  10. var myName:String=tmp[tmp.length-1].split(".swf")[0];
  11. }
  12.  
  13. public function Main() {
  14. super();
  15. if (stage)
  16. init();
  17. else
  18. addEventListener(Event.COMPLETE, init, false, 0, true);
  19. }
  20. }

Report this snippet  

You need to login to post a comment.