Posted By

adrianparr on 02/10/10


Tagged

url path server swf address root localhost loaderInfo


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

digiteyes
tspitzr


AS3 Get URL of current Flash Movie (SWF)


 / Published in: ActionScript 3
 

URL: http://renaun.com/blog/2008/10/16/264/

  1. var myUrl:String = unescape(LoaderInfo(this.root.loaderInfo).url);
  2.  
  3. trace("myUrl: "+myUrl);

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: adrianparr on February 10, 2010

You can get just the filename using this code ... http://snipplr.com/view/22404/flash-get-filename-from-full-url/

function getFilenameFromUrl(url:String):String { var letters:Array= []; var charPosition:int= url.length; var currentCharacter:String;

while(currentCharacter != '/' && currentCharacter != '\\') {
    currentCharacter = url.charAt(charPosition);
    letters.push( currentCharacter);
    charPosition--;
}
letters = letters.reverse();
letters.shift();
var filename:String = letters.join('');
return filename;

}

You need to login to post a comment.