Hello,
I have a question about accessing loaded swf files by SWFLoader class.
I am loading swf file and want to play/stop its content on certain event managed by certain function, not autoplay.
I have managed to access child clip of loaded swf (see sample code below).
But is there a way to "play" directly the loaded swf file, so I do not have to put all my animations into child clips of loaded swf?
Thanks up front for any suggestions
kuba
import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;
import com.greensock.loading.data.*;
import flash.display.MovieClip;
var clip_var:MovieClip;
var myLoader:SWFLoader = new SWFLoader("data/swf/test2.swf", {name:"nameSwf", container:container_mc, autoPlay:false, onComplete:completeHandler} );
//start loading
myLoader.load();
function progressHandler(event:LoaderEvent):void
{
//trace("progress: " + event.target.progress);
}
function completeHandler(event:LoaderEvent):void
{
trace(event.target + " is complete!");
clip_var = myLoader.getSWFChild("clip_test") as MovieClip;//GET CHILD CLIP OF LOADED SWF (NAMED "clip_test")
}
function errorHandler(event:LoaderEvent):void
{
trace("error occured with " + event.target + ": " + event.text);
}
function swfPlay(e:MouseEvent):void
{
clip_var.play();
}
stage.addEventListener(MouseEvent.CLICK, swfPlay);