PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
contentLoaderInfo.addEventListener Original File Name???
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: contentLoaderInfo.addEventListener Original File Name???

  1. #1
    Senior Member
    Join Date
    Jul 2004
    Posts
    264

    Question contentLoaderInfo.addEventListener Original File Name???

    Hi guys,

    I'm using this code to load a file...
    Actionscript Code:
    var swfLoader:Loader = new Loader();
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
    swfLoader.load("MyNiceFile.swf");

    function loadProdComplete(e:Event):void {
    trace("Loaded File: " + ????); // I want to see: "Loaded File: MyNiceFile"
    }

    How do i get the file name that has been loaded? How do i get "MyNiceFile.swf" -- or even better "MyNiceFile"

    I have tried this...

    e.content.name, but all i see is "instance32" which must be the temp name of the loaded file.

    Any help would be great!

    Cheers.

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Posts
    264
    Ok, answering my own question until someone can give me a better answer.

    If anyone else is trying to do this, the only way I've found to get the file name of the file being loaded is to use the "url" parameter:

    var fileName:String = (swfLoader.loaderInfo.url.slice(swfLoader.loaderIn fo.url.lastIndexOf("/")+1,swfLoader.loaderInfo.url.lastIndexOf(".") ))

    It seems a bit over the top to get the filename though

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center