我在舞臺上播放了幾個視頻文件。我已將它們轉換爲影片剪輯,以便通過單擊來縮放和拖動它們。問題是我無法循環它們。動畫片段問題中的Flash視頻
然後我試圖讓它們成爲SWF播放對象,但之後我的代碼沒有與他們合作。
下一步是讓他們嵌入視頻對象,以便他們自動循環和代碼工作。之後,出現了一些問題,即物體在某個時刻複製。
這是原始代碼,因爲視頻是動畫片段。
var allDraggables:Array = new Array();
var mouseHold = false;
stage.addEventListener(MouseEvent.MOUSE_UP, mUp);
function mUp(MouseEvent)
{
mouseHold = false;
}
function draggableObject(mc)
{
var mouseOnThisObject = false;
allDraggables.push(mc);
mc.addEventListener(Event.ENTER_FRAME, drag);
mc.addEventListener(MouseEvent.MOUSE_DOWN, mDown);
function mDown(MouseEvent)
{
mouseHold = true;
mouseOnThisObject = true;
}
function drag(MouseEvent)
{
if (mouseHold == true && mouseOnThisObject == true)
{
mc.addEventListener(Event.ENTER_FRAME, dragger);
}
if (mouseHold == false)
{
mc.removeEventListener(Event.ENTER_FRAME, dragger);
mouseOnThisObject = false;
}
}
mc.doubleClickEnabled = true;
mc.addEventListener(MouseEvent.DOUBLE_CLICK, scaleMe);
function scaleMe(e:MouseEvent)
{
if (e.target.scaleX < 2)
{
e.target.scaleX= e.target.scaleY = 2;
}
else (e.target.scaleX= e.target.scaleY = 1);
}
function dragger(Event)
{
mc.x+=(mouseX-mc.x)/3;
mc.y+=(mouseY-mc.y)/3;
for (var i:int=0; i<allDraggables.length; i++){
if(mc.hitTestObject(allDraggables[i]) && getChildIndex(allDraggables[i]) > getChildIndex(mc)){
swapChildren(allDraggables[i], mc)
}
}
}
}
draggableObject(green);
draggableObject(red);
draggableObject(video1);
draggableObject(video2);
draggableObject(video3);
所以我想要的結果是,視頻的行爲就像動畫片段,並且它們循環着。無論我怎樣做。 – Snellman