Using events in an external swf to load a new external swf

Posted by wdense51 on Stack Overflow See other posts from Stack Overflow or by wdense51
Published on 2010-03-31T04:05:44Z Indexed on 2010/03/31 4:13 UTC
Read the original article Hit count: 645

Filed under:
|
|

Hi

I'm trying to get an external swf to load when the flv content of another external swf finishes playing.

I've only been using actiosncript 3 for about a week and I've got to this point from tutorials, so my knowledge is limited.

This is what I've got so far:

Code for External swf (with flv content):

import fl.video.FLVPlayback;

import fl.video.VideoEvent;



motionClip.playPauseButton = player;
motionClip.seekBar = seeker;




motionClip.addEventListener(VideoEvent.COMPLETE, goNext);



function goNext(e:VideoEvent):void {

nextFrame();

}

And this is the code for the main file:

var Xpos:Number=110;
var Ypos:Number=110;
var swf_MC:MovieClip = new MovieClip();
var loader:Loader = new Loader();

var defaultSWF:URLRequest = new URLRequest("arch_reel.swf");

addChild (swf_MC);
swf_MC.x=Xpos
swf_MC.y=Ypos

loader.load(defaultSWF);
swf_MC.addChild(loader);
//Btns Universal Function
function btnClick(event:MouseEvent):void{
SoundMixer.stopAll();
    swf_MC.removeChild(loader);

    var newSWFRequest:URLRequest = new URLRequest("motion.swf");
    loader.load(newSWFRequest);
    swf_MC.addChild(loader);


}
function returnSWF(event:Event):void{
    swf_MC.removeChild(loader);
    loader.load(defaultSWF);
    swf_MC.addChild(loader);
}
//Btn Listeners
motion.addEventListener(MouseEvent.CLICK,btnClick);

swf_MC.addEventListener(swf_MC.motionClip.Event.COMPLETE,swf_MC.motionClip.eventClip, returnSWF);

I'm starting to get an understanding of how all of this works, but it's all to new to me at the moment, so I'm sure I've approached it from the wrong angle.

Any help would be fantastic, as I've been trying at this for a few days now.

Thanks

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about external