Friday, March 26, 2010

SWF in PDF - keyListener

All:

I have a SWF with a keyListener that I am using to toggle the visibility of a movie clip. This works great when I play the SWF in the FlashPlayer.exe.

When the SWF is placed into a PDF, the mouse events all work great, but the keyListener no longer works.


Any ideas as to why this might be?

Matt

SWF in PDF - keyListener

Probably Acrobat had other plans for the key :-)

No, honestly:

Try out a rare key like ~ and see if that works

a second possibility would be: the stage of the swf has no focus or the movieclip you focused has disappeared from stage (so the Event can not bubble up)?If you click on a movieclip to make it disappear, that disappeared moviclip has still the focus, and so naturally keyboardevents won`t work.

set the EventHandler explicitly to the stage

stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);

and after clicking on something that gets removed add the following code to your mousehandler (to regain that Overall-focus)


stage.focus = stage;
  • philosophy
  • No comments:

    Post a Comment