我有这个循环的flv视频,我有一部随机电影,在电影运行时播放。当我播放另一部要禁用的shaker
电影或停止随机循环时我需要。谢谢
ns.addEventListener(NetStatusEvent.NET_STATUS, NCListener);
function NCListener(e:NetStatusEvent){
if (e.info.code == "NetStream.Play.Stop") {
ns.play("video_2.flv");
shaker(null);
}
};
addEventListener(Event.COMPLETE,shaker);
function shaker (event:Event):void{
var mcArray:Array = [loader.button_01_mc,loader.button_02_mc,loader.button_03_mc,loader.button_04_mc,loader.button_05_mc];
var clipTimer:Timer = new Timer(4000);
clipTimer.addEventListener(TimerEvent.TIMER, playClips);
function playClips(event:TimerEvent):void{
var i:Number=Math.floor(Math.random() * mcArray.length);
var movieClipToEdit:MovieClip=mcArray[i] as MovieClip;
movieClipToEdit.gotoAndPlay (1);
}
clipTimer.start();
}
loader.button_01.addEventListener(MouseEvent.CLICK, play_video_01);
loader.button_01.addEventListener(MouseEvent.ROLL_OVER, play_effect_01);
function play_video_01 (event:MouseEvent){
ns.play("video_3.flv");
loader.button_01_mc.gotoAndPlay (41);
答案 0 :(得分:1)
试试这个: 将计时器向上移动并退出功能。 在所需功能中调用停止。
更新1:恢复对计时器所做的更改并添加单一播放功能,以便只播放一个动画。 (不会循环播放动画,只是随机播放。)
ns.addEventListener(NetStatusEvent.NET_STATUS, NCListener);
function NCListener(e:NetStatusEvent){
if (e.info.code == "NetStream.Play.Stop") {
ns.play("video_2.flv");
shaker(null);
}
};
addEventListener(Event.COMPLETE,shaker);
function shaker (event:Event):void{
var mcArray:Array = [loader.button_01_mc,loader.button_02_mc,loader.button_03_mc,loader.button_04_mc,loader.button_05_mc];
var clipTimer:Timer = new Timer(4000);
clipTimer.addEventListener(TimerEvent.TIMER, playClips);
var refCurrentAnimation:MovieClip;
function playClips(event:TimerEvent):void{
if(!refCurrentAnimation)
{
var i:Number=Math.floor(Math.random() * mcArray.length);
var movieClipToEdit:MovieClip=mcArray[i] as MovieClip;
movieClipToEdit.gotoAndPlay (1);
refCurrentAnimation = movieClipToEdit;
clipTimer.stop();
}
}
clipTimer.start();
}
loader.button_01.addEventListener(MouseEvent.CLICK, play_video_01);
loader.button_01.addEventListener(MouseEvent.ROLL_OVER, play_effect_01);
function play_video_01 (event:MouseEvent){
ns.play("video_3.flv");
loader.button_01_mc.gotoAndPlay (41);
}