Link to home
Start Free TrialLog in
Avatar of PaulyWolly
PaulyWolly

asked on

Cannot use ESCAPE key in Flash CS3. Not being detected

I want to use the ESCAPE key in Flash CS3 to return from FULLSCREEN mode and do an action as it returns to NORMAL mode. I am finding that I can use any other key except the ESCAPE key to do this.

I have this code but it is partially working:

// code on a button to go to FULLSCREEN mode
on (release) {
   Stage.displayState = "fullScreen";
   //make image on _root NOT VISIBLE
   _root.ds_bkgd._visible = false;
}
// code on button to return to NORMAL mode
on (press) {
   Stage.displayState = "normal";
   // make image on root VISIBLE
   _root.ds_bkgd._visible = true;
}
// set up a text field to show what we pressed
txtField.text = "Empty";
var KeyListener:Object = new Object();
KeyListener.onKeyDown = function():Void  {
    if (Key.getCode() == 27) { // escape key
        //trace("Escape Key was Pressed");
        txtField.text = "Escape Key was Pressed";
        // make image on _root VISIBLE
        _root.ds_bkgd._visible = true;
    }
    if (Key.getCode() == 32) { // space bar
        //trace("Space Bar was Pressed");
        txtField.text = "Space Bar was pressed";
    }
};
Key.addListener(KeyListener);

I have not found any information on the internet to offer an answer to this. I am also sure that I am not the only person with this question.
ASKER CERTIFIED SOLUTION
Avatar of PaulyWolly
PaulyWolly

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
pls make a request in the commuity clean up section to have your question deleted and your points refunded.