Monday, 15 September 2014

actionscript 3 - AS3 Flash change combobox value cause keydown events are disabled -



actionscript 3 - AS3 Flash change combobox value cause keydown events are disabled -

i'm using flash pro cs6.

i created fla project , set in combobox. place next code in action:

import flash.events.keyboardevent; this.stage.addeventlistener(keyboardevent.key_down, onkeydown); this.stage.addeventlistener(keyboardevent.key_up, onkeyup); function onkeydown(e:keyboardevent) { trace("keydown :" + e.charcode); } function onkeyup(e:keyboardevent) { trace("keyup :" + e.charcode); }

both event work fine @ origin when alter combobox value, event key_down no longer work.

here sample project: untitled-1.fla

as baris said, should utilize stage.focus = null after selecting combobox element :

cb.addeventlistener(event.change, cb_on_change) function cb_on_change(e:event):void { stage.focus = null }

click anywhere on stage dont solve problem if there no element on stage receive focus.

actionscript-3 flash events combobox keydown

No comments:

Post a Comment