Hey guys,
I’m using the syntax below for a Flash (CS3 and AS2) presentation so the client can play/stop and rewind/forward the movie with the keyboard.
It works perfectly when I go “Control >>> Test Movie” but when I publish the movie as a Projector file nothing happens when I hit the relevant keys.
Also, the same thing happens if I open the SWF outside of Flash from it’s local folder.
Does anyone know why this could be happening?
Thank you and I hope to hear from you.
J
import mx.utils.Delegate;
var nCheckPoint:Number = 0;
var aCheckPoints:Array = new Array();
aCheckPoints.push( { sScene:"Scene 1", nFrame:10 } );
aCheckPoints.push( { sScene:"Scene 1", nFrame:27 } );
aCheckPoints.push( { sScene:"Scene 2", nFrame:54 } );
aCheckPoints.push( { sScene:"Scene 3", nFrame:17 } );
var oListener:Object = new Object();
oListener.onKeyDown = Delegate.create(this, onKeyDown);
Key.removeListener(oListener);
Key.addListener(oListener);
function onKeyDown():Void
{
switch(Key.getCode())
{
case Key.RIGHT:
nCheckPoint++
if(nCheckPoint >= aCheckPoints.length) {
nCheckPoint = 0;
}
GoToCheckPoint(nCheckPoint);
break;
case Key.LEFT:
nCheckPoint--;
if(nCheckPoint < 0) {
nCheckPoint = aCheckPoints.length - 1;
}
GoToCheckPoint(nCheckPoint);
break;
case Key.SPACE:
//Place your routine here maybe stop();
break;
default:
trace("UNHANDLED KEY");
break;
}