views:

1450

answers:

1

Here's the scenario:

  1. i've created an external.swf that contains an embedded video (FLV) in the timeline.
  2. i've created another swf file (player.swf) that loads the external.swf using this:

    var request:URLRequest = new URLRequest("external.swf"); var loader:Loader = new Loader(); loader.load(request); videoContainer_mc.addChild(loader);

  3. i inserted a skipIntro_btn in player.swf using:

    skipIntro_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownSkip); function mouseDownSkip(event:MouseEvent):void { videoContainer_mc.removeChild(loader); gotoAndPlay("ending"); }

it seems that the skipIntro_btn unloads the external.swf, but i can still hear the audio of the embedded video. what am i doing wrong? are there any other ways to implement the skip intro effect on embedded videos?

A: 

Well, if you can just remove the swf after the click, like this:

var request:URLRequest = new URLRequest("external.swf");
var loader:Loader = new Loader(); 
loader.load(request); videoContainer_mc.addChild(loader);

skipIntro_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownSkip);
function mouseDownSkip(event:MouseEvent):void { 
    videoContainer_mc.removeChild(loader);
    loader.unloadAndStop(true);
    gotoAndPlay("ending");
}

If you can't just remove the swf, then you'll need to stop the movieclip that contains the video inside the loaded swf.

ruyadorno
thanks ruyadorno:the code you gave made a compiler error:1061: Call to a possibly undefined method unloadAndStop through a reference with static type flash.display:Loader.
OK... i got it.... unloadAndStop() works for flashplayer 10... thanks for the help... now all i have to do is make the clients use flash player 10... LOL
LOL, that should be good for everyone... but like I said before, you can call the stop on the movieclip that contains the video on it, then everything should stop since the video object is related to timeline.Another trick is use movieclip.soundTransform = new SoundTransform(0); to stop the sounds of the movieclip that contains the video.
ruyadorno