
February 25th, 2012, 07:16 AM
|
|
|
|
ActionScript 3 - 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.
|