Question

i am using this code to play my animation using my keyboard, but for some reason i dont understand, i need to click on the stage first to make it work whe it should work automaticaly, can anyone help me to fix this please?

var collage

collage=0

function gocollage1(e:KeyboardEvent):void

{

if (collage==0 && e.keyCode == Keyboard.RIGHT)

{

collage=1

myanimation.play();

}

}

stage.addEventListener(KeyboardEvent.KEY_DOWN, gocollage1);

Was it helpful?

Solution

If you want to set the swf focus to the stage.

stage.focus = stage;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top