Make buttonMode enabled dynamic text fields with AS3

January 4th, 2010

This is a little niggling problem that I find myself rediscovering every now and then when working with dynamic text – particularly dynamic text as part of an interface. When you have a movieclip with buttonMode set to true, you expect the cursor to change to a pointing hand whenever it is over any part of the movieclip, as in this example:

Mousing over the button gives you a hand cursor, updates the button to it’s ‘over’ state, and changes the text at the top, all as expected. The problems arise when using a dynamic text field to label the button, like this:

Mousing over the button still changes it’s state and alters the text, and to a certain extent changes the cursor. However, when you move the cursor over the text field it goes back to a regular arrow, despite the fact that flash can clearly tell it’s still over the button, as evidenced by the ‘over’ state of the button, and the top text field.

Read the rest of this entry »