开发者

FocusEvent.FOCUS_OUT event's relatedObject always null

开发者 https://www.devze.com 2023-02-26 12:23 出处:网络
I\'m trying to code a drop-down control in as3, where clicking on the control\'s \'top-text\' (a Sprite) causes a box to appear (another Sprite). The box contains a list of all items that may be selec

I'm trying to code a drop-down control in as3, where clicking on the control's 'top-text' (a Sprite) causes a box to appear (another Sprite). The box contains a list of all items that may be selected. When 'item1' is selected the box closes and item1-text becomes the control's top-text. And so on.

I also want the box to automatically close when the control loses focus, i.e. when the user clicks anywhere else on the flash movie. For this, I add an event listener on the box for FocusEvent.FOCUS_OUT.

The thing is, I want different processing to take place depending on the FocusEvent's relatedObject. To be more precise I want to do something more than just closing in the specific case where relatedObject is a child of the drop-down con开发者_运维知识库trol itself. And just close it if not.

My problem is that the relatedObject property is always coming up null no matter what gains focus. Furthermore the isRelatedObjectInaccessible property is always false so (according to the documentation) it is not a security related problem.

Any ideas?


try to use flash.events.MouseEvent.MOUSE_DOWN intead of FOCUS_OUT. handle it on the clip under the control.


Turns out this behavior is caused by the Doomsday Console which was added to the stage as part of the project I was working on. Removing it solved the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号