How to get an SWF to recognize its own filename

The following actionscript on the main timeline will produce a string of “filename.swf”


var myFileName:String = myFileName = this._url;
myFileNameArray = myFileName.split("/");
num = myFileNameArray.length;


thisSWF = myFileNameArray[num-1];
trace(thisSWF);

Thanks to the Actionscript.org forums for the idea.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>