I would like to get the absolute path of my swf file from within Actionscript.
E.g. if the script called "http://www.mysite.com/banner/flash.swf" I'd expect "/banner"
In PHP I would do:
$fpath = str_replace('\\', '/', dirname(__FILE__));
$path = str_replace($_SERVER['DOCUMENT_ROOT'], '', $fpath);
How can I do this in Actionscript?
Best Answer
I use this function in the top most class (the one that extends Sprite for AS3 projects or mx:Application for Flex projects).
You could probably modify this to fit your needs.