Dynamic text fields

okay, this is my first post here, so have patience, please…
i have been working on creating a button movie clip so i can controll all the aspects of the button, specifically to create a drop down menu that appears beside the button when moused over… i am using dynamic text fields so i can use the button MC over and over and just tell it what i want it to say…
It does display the text in the initial text field (visitor_mc.text_txt.text), but not in the sub-menu text field (visitor_mc.sub1_txt.text)… by the way the sub-menu is just later in the timeline at a label i called “rollover”… confused yet? here’s the code i was using…

visitor_mc.text_txt.text = “Visitors”;
visitor_mc.sub1_txt.text = “Classes”;

the second line of code wont display anything…
i have exhausted my self… please help!!!

Howdy and Welcome… :slight_smile:

It is abit hard to say without seeing what you have, but here we go…

I think your code, visitor_mc.sub1_txt.text = “Classes”;, is not working because visitor_mc does not exist when that command is executed… Why don’t you move that line right under the frame where ‘rollover’ label is and see if it does the trick for you…

:cowboy:

that would work except that visitor_mc is the instance name of the MC button that i created and i think you are right that it doesn’t work cos it is not loaded at that time, so… how does one go about sending that info down the visitor_mc’s time line to the “rollover” frame?:-\
thanks for any help y’all can offer!!!

Howdy… You can call me dumb, but I am not really able to imagine what you have in your file and what you are exactly trying to… Would you create a little sample that show what the problem is and what you are trying to??? :wink:

ok here’s the fla, check it out and let me know what ya think…

thank you

Okay… Whole lot easier to answer the question with the file… =)

This is the script from the frame 1 of the main timeline…

visitor_mc.trackAsMenu;
visitor_mc.text_txt.text = "zap"; 
//this is the part that doesn't work...
//sub1_txt is the dynamic text field in frame 15 "rollover"
//visitor_mc.sub1_txt.text = "pop";
subText1 = "pop";

visitor_mc.sub1_txt.text = “pop”; is not working as you would expect, because that sub1_text does not exists on the frame 1 of that movieclip timeline… It exists from frame 15 to 25…
So, I have added another variable and assigned the value to it…

I use that variable from the movieclip itself… Frame 15 of the mc_navbtn_up

stop();
sub1_txt.text = _parent.subText1;
this.onRollOut = function(){
	gotoAndStop("_up");
	text_txt.textColor = 0x0000CC;
};

As you can see, I have assigned the value of that text field from here with the given variable that I have assigned on the main timeline…

Let me know if you need further assistance… :wink:

thank you so much. i had tried to assign a variable earlier, but forgot to put in _parent!
you’re a life saver!

You’re welcome… :wink:

okay, this may seem dumb, but how can i use another instance of this MC and have different text in the variable? is this a matter of scope?

Now, you gotta change the pathing system again… :beam:
See if this is what you want… and let me know…

visitor_mc1.trackAsMenu;
visitor_mc1.text_txt.text = "zap"; 
visitor_mc1.subText1 = "pop";
visitor_mc1.subText2 = "soda";
visitor_mc1.subText3 = "juice";

visitor_mc2.trackAsMenu;
visitor_mc2.text_txt.text = "OS"; 
visitor_mc2.subText1 = "Windows";
visitor_mc2.subText2 = "Macintosh";
visitor_mc2.subText3 = "Unix/Linux";
stop();
sub1_txt.text = subText1;
sub2_txt.text = subText2;
sub3_txt.text = subText3;
this.onRollOut = function(){
	gotoAndStop("_up");
	text_txt.textColor = 0x0000CC;
};

tried that one already and the sub text fields are empty when they put after visitor_mc. (you know), i am not sure where else to go from here…

i just downloaded your version and it worked fine, but i had the exact same code when i tried it and mine wont work… bizzare. thanks, for the help.

Um… I don’t know why yours didn’t work, but as long as you got one working copy… :wink: