0
Button onLoad? Constructor?
Explorer
,
/t5/animate-discussions/button-onload-constructor/td-p/574627
Jun 16, 2006
Jun 16, 2006
Copy link to clipboard
Copied
I haven't worked with Actionscript in a LONG time... back
before it was much of anything. So if I'm going about this wrong, I
apologize.
I want to name a button instance on the stage at dev time and have the text set to the name of the instance at run time. I figured I could find the name of the instance(it's gotta be a property somewhere in there, right?) and just assign that string to the of the dynamic text field I placed in the button.
This just seems like a nice, clean, easy-to-maintain way of using a button.. when clicked, it would pass it's name to some handler at the root which would figure out what to do with it.
Ideas? Counter-ideas?
Thanks in advance,
Scott.
I want to name a button instance on the stage at dev time and have the text set to the name of the instance at run time. I figured I could find the name of the instance(it's gotta be a property somewhere in there, right?) and just assign that string to the of the dynamic text field I placed in the button.
This just seems like a nice, clean, easy-to-maintain way of using a button.. when clicked, it would pass it's name to some handler at the root which would figure out what to do with it.
Ideas? Counter-ideas?
Thanks in advance,
Scott.
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

/t5/animate-discussions/button-onload-constructor/m-p/574628#M324514
Jun 16, 2006
Jun 16, 2006
Copy link to clipboard
Copied
mc._name
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
KCL
AUTHOR
Explorer
,
LATEST
/t5/animate-discussions/button-onload-constructor/m-p/574630#M324520
Jun 16, 2006
Jun 16, 2006
Copy link to clipboard
Copied
Didn't realize I had to embed it in a movieclip. Now it all
seems to make sense, except it's not working...!
OK. So, here's what I've got so far:
I have a button called btn_blue in my library with the four states, up/over/down/hit.
Within btn_blue, I have two layers: textLayer and bgLayer.
Within textLayer, I have a textField called optionText (set to dynamic text, obviously.)
In my movieClip, I have an instance of btn_blue called thisButton.
The code at the top of the movieClip (Layer 1, Frame 1), I have:
onLoad = function() {
thisButton.optionText.text = this._name;
}
But no workie. I must have my references wrong somehow, but I'm feeling a bit lost.
Halp?
OK. So, here's what I've got so far:
I have a button called btn_blue in my library with the four states, up/over/down/hit.
Within btn_blue, I have two layers: textLayer and bgLayer.
Within textLayer, I have a textField called optionText (set to dynamic text, obviously.)
In my movieClip, I have an instance of btn_blue called thisButton.
The code at the top of the movieClip (Layer 1, Frame 1), I have:
onLoad = function() {
thisButton.optionText.text = this._name;
}
But no workie. I must have my references wrong somehow, but I'm feeling a bit lost.
Halp?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/animate-discussions/button-onload-constructor/m-p/574629#M324517
Jun 16, 2006
Jun 16, 2006
Copy link to clipboard
Copied
mc._name
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

