Home > Default > Button Symbol and text change.

Button Symbol and text change.

November 30Hits:0
I have a button symbol with an Instance name of myButton that
has a text field in it. The text field is dynamic and an Instance
name of myText.
I'm trying to change the text from a class I've created like
myButton.myText.text = "Changed Text";
I'm getting this...
1119: Access of possibly undefined property myText through a
reference with static type flash.display:SimpleButton.
Can someone please tell me where I'm going wrong please.
Thanks in advance for any help.


Is the TextField added in design time - that is you placed it
using the Flash IDE? In that case you might not be able to
reference it.
Rather you need to add it in a DisplayObject container during
runtime using the various SimpleButton state properties such as
downState and upState. See the example at SimpleButton doc.

Read other 4 answers


Copyright (C) 2017 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 12 q. 0.115 s.