开发者

MovieClip looses handCursor when TextField added to it,why?

开发者 https://www.devze.com 2023-04-04 16:14 出处:网络
I am making an application where I need to create al开发者_开发技巧l controls by code so no flash ide is used. I am also creating a btn:MovieClip which will be a button and I add event listeners to it

I am making an application where I need to create al开发者_开发技巧l controls by code so no flash ide is used. I am also creating a btn:MovieClip which will be a button and I add event listeners to it and also useHadCursor and ButtonMode are true. I also add a static text field with text in it "Save" so this would be save button.

But when I add the textfield the movieclip stops to show the hand cursor. What am I doing wrong?


I am assuming the problem is caused by the textfield. Having said that if your movieclip has only textfield in it try setting mouseChildren to false. By doing so you can effectively prevent the mouse from being enabled for all instances within any display object container.But remember that it will apply to all children.

You can disable mouse interaction by setting their mouseEnabled property to false for the particular textfield you want. However, if you only want to disable certain mouse events for a collection of objects within a container, you'll need to take an alternate approach. In this situation, you'll use an event listener in the target parent instance listening for the event to be disabled and have that listener stop propagation of that event. This prevents the listeners working for objects within that container from being called.


I have had problems with TextFields and cursors in the past. It seems that TextFields have some special characteristics that give it priority over mouse events. This is important so that when you mouse over a TextField, you can get the text entry cursor for input TextFields.

As far as the solution goes - try setting the mouseEnabled and selectable properties to false on the TextField.


theTextField.selectable = false; should be enough. Setting mouseEnabled or mouseChildren to false can cause undesirable consequences in certain situations.

PS: Unless one of its parents has useHandCursor set to true. Then you WILL need mouseChildren on the parent set to false, or mouseEnabled set to false on the TextField.

0

精彩评论

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