flash - Accessing SimpleButton TextField -
i've been trying change text within simplebutton instance using this:
var drawbutton:simplebutton = main.drawbutton; var upbutton:displayobjectcontainer = drawbutton.upstate displayobjectcontainer; var upbuttontext:textfield = upbutton.getchildat(1) textfield; upbuttontext.text = "pause";
i found solution here: how can change texts in dynamic textfields in simplebutton instance (button symbol)?
unfortunately, upbuttontext
return null. according debug, upbutton
has 3 children, tried getchildat([0-2])
try , text didn't happen. tried getting instance name, no luck. know why isn't working?
appreciate help.
for others' information first of set tlf text editable.
then used code string inside button:
var upstate:sprite = sprite(drawbutton.upstate); var uptext:string = tlftextfield(upstate.getchildat(2)).text;
and change text: tlftextfield(upstate.getchildat(2)).text = "paused";
this works, , tested.
thanks user elekwent tips.
Comments
Post a Comment