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

multiple mp4 videos code for looping (as3)

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、../..

这将解决您的问题:

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