PDA

View Full Version : Dynamic Text assignment problem


JerryRowe
09-24-2003, 02:46 AM
I have 4 dynamic text boxes that I want to correspond to different variables (specifically, text strings).

I want the variables to change when the user mouses over different buttons. The idea is for different text to change every time the mouse rolls over a button.

They are in different movie clips, but it never works even when I try to make them global variables. Can someone please explain how I can do the variable-changing thing? This has really gotten me frazzled, sadly. Please help. Thanks.

Jerry Rowe

PS - (This is for FlashMX)

Billy T
09-24-2003, 06:51 AM
helps if you post your code but it would be something like

my_btn.onRollOver=function(){
myVar1="blah blah";
//my_mc is the movieclip instance name and
//my_txt is the text box instance name
my_mc.my_txt.text=myVar1;
//etc
}

cheers

JerryRowe
09-24-2003, 01:58 PM
I just tried it, and the code doen't work at all. It may be because the button is one movie clip, and the text boxes are in another, and they are both in one large movie clip.

There are two movie clips (button, and BoxSet) inside one movie clip (Picture).

"Button" has the following code:

on(rollOver){
trace("loaded");
Var1 = "Name1";
Var2 = "Name2";
Var3 = "Name3";
Var4 = "Name4";
}


Boxset has four dynamic text boxes that have the variables Var1- Var4. I was told that this would not need any code, because the text boxes should automatically display the text once the variables change.

I tried several different things for the code for the BoxSet movie clip, but nothing has worked. I also tried making the Var1-4 variables to be _global varaibles, but that didn't make it work, either. I really am stumped on this one, which is really frustrating, because it seems so simple. Thanks for any help you can give.

JR

Billy T
09-24-2003, 06:52 PM
should upload the file

you need to target the timeline where the variables are stored. If you want your text boxes to show the variables automatically then you need to make BoxSet the timeline that stores those variables

on(rollOver){
trace("loaded");
BoxSet.Var1 = "Name1";
BoxSet.Var2 = "Name2";
BoxSet.Var3 = "Name3";
BoxSet.Var4 = "Name4";
}

make sure BoxSet has an 'instance name' (not just a library name) and check out the tute on paths

cheers

JerryRowe
09-25-2003, 12:27 PM
Okay, here's the file. I want to make it so when you mouse over the names, they appear in the other box. Let me know how I can do it...This is driving me nuts. Thanks!

Jerry Rowe

Billy T
09-25-2003, 09:03 PM
ok for starters you have it all inside a graphic symbol - this is a bad idea. Select the graphic on the stage and choose 'break apart' once.

You have multiple actions for the button so they will end up erasing each other. Remove the actions placed directly on the Adam button, give the Adam button an instance name of "Adam" and put these actions on the frame

fscommand("fullscreen", "true");
Adam.onRollOver=function(){
Name1 = "Adam";
NameBox.Box1.text = Name1;
}

then go inside NameBox and remove the variable names from the text boxes

cheers

JerryRowe
09-26-2003, 02:02 AM
Thank you so much! I feel much relieved.

Jerry Rowe

Billy T
09-26-2003, 05:54 AM
no problem