说我有一个.flv包含fullHD的180帧。Flash - 顺利滚动MovieClip
我将其导入到Flash(或flex)中,并且希望能够通过单击并拖动视图来平滑浏览时间轴。
我该怎么做?
我目前的解决方案是将每个帧加载到一个BitmapData数组中,该数组可以工作,但它使用1,5 GB的内存,这可能会导致我的一些问题。
我只需要一种方法能够点击并拖动左/右来平滑地向前/向后滚动帧。
在我的简单测试中,它确实很滞后。
这是我简单的测试代码,这是waaaay到laggy:
import flash.events.Event;
import flash.events.MouseEvent;
stop();
var mouseDownValue:Boolean = false;
var currentFrameValue:int = 0;
var maxFramesValue:int = 180;
var oldMouseX:int;
myMovie.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
myMovie.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
myMovie.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
function mouseDownHandler(evt:MouseEvent):void{
mouseDownValue = true;
}
function mouseUpHandler(evt:MouseEvent):void{
mouseDownValue = false;
}
function mouseMoveHandler(evt:MouseEvent):void{
if(mouseDownValue){
if(oldMouseX<0) oldMouseX = mouseX;
currentFrameValue += (oldMouseX - mouseX)/2;
if(currentFrameValue>=(maxFramesValue-2)) currentFrameValue -= (maxFramesValue-1);
if(currentFrameValue<0) currentFrameValue += (maxFramesValue-1);
myMovie.gotoAndStop(currentFrameValue+1);
oldMouseX = mouseX;
}
}
我知道这是旧的,但+1从我这里解决了我在Flash中使用视频时间线上的问题。谢谢! – 2014-04-22 09:23:22