fullHD で 180 フレームを含む .flv があるとします。
これを Flash (または flex) にインポートし、ビューをクリックしてドラッグすることでタイムラインをスムーズにナビゲートできるようにしたいと考えています。
どうすればいいですか?
私の現在の解決策は、各フレームを BitmapData 配列にロードすることですが、これは機能しますが、1.5 GB のメモリを使用するため、問題が発生する可能性があります。
クリックして左右にドラッグして、フレームを前後にスムーズにスクロールできる方法だけが必要です。
私の簡単なテストでは、本当に遅いです。
これは私の簡単なテストコードです。
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;
}
}