Ive got a FLV loaded into a flash file and some basic keyboard function to scroll back and forth through the embedded movie.
Going forwards is fine, but when I hit the back key is takes a long time to respond and then the fram rate drops.
Anyone got any ideas why?
I imported the FLV to the library and then dragged over to a layer. The FLV is only 2MB.
Here is the code, although its copied and adapted from another source.
package {
import flash.display.MovieClip;
import flash.display.StageDisplayState;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import com.greensock.TweenLite;
import com.greensock.easing.*;
import com.flupie.textanim.*;
public class Presentation extends MovieClip
{
private var isPlayingForward:Boolean;
private var timelineTimer:Timer;
public function Presentation()
{
try
{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
catch (err:SecurityError)
{
trace("Must be in projector mode for full screen viewing");
}
isPlayingForward = true;
timelineTimer = new Timer(1000/stage.frameRate);
timelineTimer.addEventListener(TimerEvent.TIMER, timelineTimerHandler);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyboardHandler);
}
private function keyboardHandler(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.RIGHT)
playForward();
if (event.keyCode == Keyboard.LEFT)
playReverse();
}
private function timelineTimerHandler(te:TimerEvent):void
{
if (isPlayingForward)
this.nextFrame();
else
this.prevFrame();
}
public function stopTimeline():void
{
stop();
timelineTimer.stop();
}
public function playForward():void
{
isPlayingForward = true;
timelineTimer.start();
}
public function playReverse():void
{
isPlayingForward = false;
timelineTimer.start();
}
}
}