#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    660
    Rep Power
    32

    How do you retrieve the file name from a variable loaded with an swf?


    I am trying to place a condition statement so that it will only do an action if the swf loaded into the varaible is the same or empty.

    I start of with loading the sample1.swf into the movieclip swf_holder
    Code:
    var loadSwf:Loader = new Loader();
    swf_holder.addChild(loadSwf);
    loadSwf.load(new URLRequest(sample1.swf));
    loadSwf.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    In order for me to get the sample1.swf to play, I create a variable so that I can just call on it
    Code:
    function loadComplete(e:Event):void{
    var loadedSwf: MovieClip(e.target.content);
    loadedSWF.play();
    }
    What I am trying to do somewhere else is add a condition so that it will do a different action if what is in the loadedSWF is not the sample1.swf.
    Code:
    if(loadedSWF != sample1.swf){
    <-- action here ->
    }
    I tried tracing loadedSWF to see what it is giving and all it gives me is [object MainTimeline] on the output.

    What I want to do is be able to get the swf name of what is loaded in the loadedSWF variable.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    660
    Rep Power
    32
    O.K. solved it. I decided to create a variable to store the names of the swf file loaded. Then used that variable for my condition.

IMN logo majestic logo threadwatch logo seochat tools logo