开发者

AS3 How do I stop sound and video when clicking a menu button to go to another frame?

开发者 https://www.devze.com 2022-12-24 18:00 出处:网络
I have a problem with my slideshow script. I have embedding a flash video file into my website with this slideshow called monoslideshow, and everything seems to work perfectly. Trouble is, when I am c

I have a problem with my slideshow script. I have embedding a flash video file into my website with this slideshow called monoslideshow, and everything seems to work perfectly. Trouble is, when I am clicking on another menu button that should jump to another frame, it still keeps playing the video and sound while displaying the new menu data. So I will probably need some code that stops the video instantly, when another menu button is clicked. But how do I write it and where do I put it?

Here is my actionscript for the video file to show:

var loaderSlide:Loader = new Loader();
var monoslideshow:Object;

loaderSlide.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
addChild(loaderSlide);

loaderSlide.load(new URLRequest("monoslideshow.swf"));

function onLoadComplete(event:Event):void { 
    monoslideshow = event.target.content;
    monoslideshow.showLogo = false;
    monoslideshow.setViewport(new Rectangle(730, 20, 700, 660));
    var xml:XML = 

<album title="TITLE" itemPath="photography/makingoff/" thumbnailPath="thumbnails/">
<contents>
<video source="VIDEO.flv" />
</contents>
</album>
    monoslideshow.loadXML(xml);
}

It w开发者_运维技巧ould be great to get a solution to this problem, otherwise my website will be kinda messy ;)

THANK YOU!!


Ok, I found the answer now. Just for people who might be having the same problem.

I put in some code for the new menu button.

flash.media.SoundMixer.stopAll();

monoslideshow.visible = false;

This stops all sounds and makes the slideshow invisible. Quick and simple :)

0

精彩评论

暂无评论...
验证码 换一张
取 消