Jump to content

kuba sanitrak

SWFLoader - play/stop loaded swf

Recommended Posts


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



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

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
stage.addEventListener(MouseEvent.CLICK, swfPlay);

Link to comment
Share on other sites

I think what you want is:


function swfPlay(e:MouseEvent):void

Link to comment
Share on other sites

Thank you Carl,

just couldn't figure it out myself. Got a bit lost in all the videos and slides filled with great stuff. The more I pushed, the more confused I got. Thanks again. Take care, kuba

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.