# Script executes in Flash but not as Projector

**URL:** <https://forum.kirupa.com/t/script-executes-in-flash-but-not-as-projector/305608>\
**Category:** flash\
**Created:** [February 28, 2010, 3:50pm UTC](https://forum.kirupa.com/t/script-executes-in-flash-but-not-as-projector/305608 "2010-02-28T15:50:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spindrift](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@spindrift](https://forum.kirupa.com/u/spindrift)\
**Post date:** [February 28, 2010, 3:50pm UTC](https://forum.kirupa.com/t/script-executes-in-flash-but-not-as-projector/305608/1 "2010-02-28T15:50:49Z")

</div>

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

```auto

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;

   }

```
