Can a button that is inside of a movie clip target a dynamic text field. Im currently working with the “infinate menu” tutorial on this site and I want to be able to click on one of the moving buttons to bring up text for that button in a dynamic text field. Does anyone know how to do this???
Yes it is possible.
In case you dont know:[AS]on (release) {
loadText = new loadVars();
loadText.load(“yourtextfile.txt”);
loadText.onLoad = function(OK) {
if (OK) {
myTextField.text = this.text;
} else {
trace(“Error”);
}
};
}[/AS]Where myTextField is your textfield instance name and text is the variable inside the txt file.
thank you , I’ll give it a try now
I tried your script but still no luck. I can see the dynamic text box(as i have enabled “show border around text”) but it just stays blank when i click on the button. Everything works if i just put a normal button on the stage and add the script, but not when its in a movie clip, it just will not work…
You have to give the right path to the textfield. If its inside a movie clip called movieclip_mc:[AS]moviclip_mc.myTextField.text = this.text;
[/AS]
is the text field inside the MC? it drove me crazy for a while - be sure to put _root.myTextFieldInstanceName if it’s on the stage by itself or _root.myMCInstanceName.myTextFieldInstanceName if not…
Excellent… I was missing the “_root.” I cant believe I just spent a full day fiddling with this when thats all it was … This can be such a frusterating program at times and it’s great that people stop in to help out… Thanks again
Yes, i know that can be a pain in the as$
Get more confortable with _root, _parent and this.
It will help you a lot.
i’ll second that… first time i had to add dynamic text fields inside an MC it was so frustrating and then i realized: _root! i don’t even use _parent anymore unless the hierarchy is very deep - i usually just use _root.mc1.mc2 so that i’m always thinking from the top level down to whatever i’m working on.
glad you got it working!