AS3 单击菜单按钮转到另一帧时如何停止声音和视频?
我的幻灯片脚本有问题。 我已通过名为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我现在找到了答案。
仅供可能遇到同样问题的人使用。
我为新菜单按钮添加了一些代码。
这会停止所有声音并使幻灯片不可见。
快速又简单:)
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.
This stops all sounds and makes the slideshow invisible.
Quick and simple :)