Sprite, buttonMode and nested TextFields
Posted: 31/12/07
I've noticed a few problems getting Sprites to behave properly in buttonMode when a TextField is nested within. An example would be using the drawing API to create a basic button shape, then adding a TextField as a child to the Sprite to act as the label. Even with the buttonMode property of the parent Sprite set to "true" and the selectable property of the TextField set to "false", the hand cursor doesn't display properly. The answer is to set another property on the TextField to prevent it from soliciting any interactions with the mouse.
myTextField.mouseEnabled = false;
In all, your Sprite and nested TextField will need the following properties set:
this.buttonMode = true;
myTextField.selectable = false;
myTextField.mouseEnabled = false;
Keywords for this post: textfield, sprite, buttonMode, mouseEnabled, selectable, flash, actionscript 3
Popular categories:
Recent posts:
- Mac OS find files using regex
- ADB device driver won't install
- Eclipse: An error has occurred. See the log file .metadata/.log
- Updated blinkbox iPad app
- Nexus 7 doesn't appear in adb devices list
- Improve the keyboard in the Samsung ICS update
- 403 Forbidden error on Mac web server
- Getting error with manually created NIB?
- Adding/removing items from PATH on Mac
- Presenting at Flash Oxford
- more...
Publications:
Places you'll find me:
Archive:
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023