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);

有帮助吗?

解决方案

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

stage.focus = stage;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top