AS3 单击菜单按钮转到另一帧时如何停止声音和视频?

发布于 2024-08-27 09:03:19 字数 924 浏览 4 评论 0原文

我的幻灯片脚本有问题。 我已通过名为 monoslideshow 的幻灯片将 Flash 视频文件嵌入到我的网站中,一切似乎都运行良好。问题是,当我单击另一个应该跳转到另一帧的菜单按钮时,它在显示新菜单数据的同时仍然继续播放视频和声音。 因此,当单击另一个菜单按钮时,我可能需要一些代码来立即停止视频。但我该如何写它以及将它放在哪里呢?

这是我要显示的视频文件的动作脚本:如果

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);
}

能找到这个问题的解决方案那就太好了,否则我的网站会有点混乱;)

谢谢!

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 would be great to get a solution to this problem, otherwise my website will be kinda messy ;)

THANK YOU!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

装迷糊 2024-09-03 09:03:19

好吧,我现在找到了答案。
仅供可能遇到同样问题的人使用。

我为新菜单按钮添加了一些代码。

flash.media.SoundMixer.stopAll();

monoslideshow.visible = false;

这会停止所有声音并使幻灯片不可见。
快速又简单:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文