user2056564
user2056564

Reputation: 183

How can I detect a selectable static text field in AS3?

I have selectable static text fields in my flash project and I need to detect them as targets on MOUSE_MOVE event. I know it can be difficult to detect StaticText class, but if a static text field is selectable, it becomes TextField class. Dynamic text, which is also TextField class, is easy to detect, but when it comes to selectable static text, I can't get this working. When I try to trace event.target on MOUSE_MOVE event, it doesn't trace anything if I hover the mouse over a selectable static text field (if it's a dynamic text field, I get [object TextField]). Why do dynamic text and selectable static text , which are the same class, behave so differently? And how can I detect selectable static text on MOUSE_MOVE or MOUSE_OVER event?

Upvotes: 2

Views: 668

Answers (2)

M4tchB0X3r
M4tchB0X3r

Reputation: 1531

Why cant you set it dynamic? Static and dynamic both extend TextField. But have the attributes set different. In this case dynamic text has mouseEnabled set to true and static has it set to false. And doesnt listen to mouseEvents in general.

Edit: you can type html text in dynamic TextField -> htmlText

Upvotes: 3

Marcela
Marcela

Reputation: 3728

As you can see in the reference for the StaticText class: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StaticText.html#eventSummary it does not dispatch any MouseEvent events, therefore it is impossible to listen for MOUSE_MOVE events on static text fields. What you can do is follow one of the suggestions proposed the last time you asked this question: How can I detect StaticText in AS3?

Upvotes: 2

Related Questions