用于循环的多个mp4视频代码(as3)

时间:2015-05-22 10:36:56

标签: actionscript-3 loops mp4

import fl.video.FLVPlayback;
import fl.video.VideoEvent;
mcV2.autoRewind = true;
mcV2.autoPlay = true;
function Loop(event:fl.video.VideoEvent):void {
    mcV2.play();
}
mcV2.addEventListener(fl.video.VideoEvent.AUTO_REWOUND, Loop);

这是循环mp4视频文件的一个很好的解决方案,thx。

如何使用此代码的2个(或更多)视频进行循环?

等:mcV1,mcV2,.. / ..

1 个答案:

答案 0 :(得分:0)

这将解决您的问题:

var myArr = ["mcV1","mcV2","mcV3"]

for(var i=0;i<myArr.length;i++){
    var targetBox:FLVPlayback = this.getChildByName("mcV"+(i+1)) as FLVPlayback;
    targetBox.addEventListener(fl.video.VideoEvent.AUTO_REWOUND, Loop);
    targetBox.autoRewind = true;
    targetBox.autoPlay = true;
}

function Loop(event:fl.video.VideoEvent):void {
    event.target.play();
}

我还添加了样本fla FLA