Return to Snippet

Revision: 46783
at May 25, 2011 00:48 by martin9999uk


Initial Code
You can use loaderInfo.loaderURL to get the full path and name of you swf

Example of a class:

public class Main extends Sprite {
 private function init():void {
  removeEventListener(Event.COMPLETE, init);
  var myUrl:String=loaderInfo.loaderURL;
  var tmp:Array=myUrl.split("/");
  var myName:String=tmp[tmp.length-1].split(".swf")[0];
 }

 public function Main() {
  super();
  if (stage)
    init();
  else
    addEventListener(Event.COMPLETE, init, false, 0, true);
 }
}

Initial URL

                                

Initial Description

                                

Initial Title
Path to swf folder in AS3

Initial Tags
path

Initial Language
ActionScript 3