Changing graphics in button layers in AS3

Subscribe to Changing graphics in button layers in AS3 3 posts

avatar for Arloistale Arloistale 65 posts
Flag Post

I need to have buttons that show numbers from 1-100. Since this would be very tedious to do, is there a way I can change the graphics in layers for a button (like adding and removing text) with code?

 
avatar for Amibtious Amibtious 394 posts
Flag Post

Make the number a textfield.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html

 
avatar for Elyzius Elyzius 277 posts
Flag Post

Yes, use a text field. You can programatically change its text if you make it dynamic. You’ll need to embed your font to make use of dynamic text fields. Don’t make the text field part of the button itself. Instead, put it on top of the button as a separate child, and be sure to set its mouseEnabled property to false. Otherwise, players won’t be able to click the button underneath the text.