PDA

View Full Version : variables calling variables



cdermyer
August 4th, 2005, 01:37 PM
hi,

i need help with a dynamic text box and what is loaded into it. the function for my buttons defines a new variable "newChoice" and sets its value to the "this.varTitle". It then tells the movie clip containing the text box gotoAndPlay (2). At that point the text box should update to the value of "newChoice" but it doesnt work.

if i tell it to update something absolute, like a string, it works, but i think there is a problem with the layers of variables i'm using. anyone know how to get around this? thanks!

//------ main function:
playDots = function () {
this.onRelease = function() {
_root.newChoice=varTitle;
tellTarget(_root.contentShift.content.wellB){
gotoAndPlay(2);
}
};
};
//------ also in the main timeline:
loadVariables("vars.txt", "");
studio.varTitle = studio_txt;
motionC.varTitle = motionC_txt;
playDots.apply(studio);
playDots.apply(motionC);
//------ the action in wellB's timeline:
//------ ("desc_txtX" is the dynamic text box)
wellA.desc_txtX=_root.newChoice;
trace(_root.newChoice);

cdermyer
August 4th, 2005, 02:42 PM
*bumb

i know somebody can tell me how to do this!

bandinopla
August 4th, 2005, 03:46 PM
explain more

cdermyer
August 4th, 2005, 05:35 PM
i'll try to be a little more clear...

to simplify there will be 2 menu items:
1: "studio"
2: "motion control"

there is also a content box mc. inside of it there is a dynamic text box called "content_txt" that will load content from an external text file.

the text file has 2 variables:
"
&studio_txt=about the studio blah blah blah.
&motionC_txt=our motion controller is great bla bla blah.
"

the text box should load the studio info when "studio" is clicked and the motionC info when "motion control" is clicked.

so the text box is told to be filled with "desc_txt", a blank var.

when the studio button is clicked, "desc_txt" needs to call the value of "studio_txt"

when the motion control button is clicked, "desc_txt" needs to call the value of "motionC_txt"

does that make sense? Am i going about this the wrong way?

(Maybe i should be using objects instead of function....)

Thanks for any help!

bandinopla
August 4th, 2005, 05:53 PM
What I need to know is... not how U whant to do that... I neeed tho know, what U whant to happen? So I can know better why U think that code.

cdermyer
August 4th, 2005, 06:01 PM
ohhh,

the old text will fade out to 0% alpha, be replaced with new text, fade back in.

bandinopla
August 4th, 2005, 06:14 PM
OK. I get it. Do this... I think that dynamic text can't have alpha... but... If can't, mut a rectangle on the top with the same color as background...

make a mc, the one that will be fade out...
make this function:

fadeInOut=function(mc){ // THIS IS FOR FADING
if(this.fadeIn){
this.alpha+=1
}else if(this.alpha>0 && !this.fadeIn){
this.alpha-=1
}else{
this.theTEXT=theVarUwant; this.fadeIn=true
}
}

in the mc that is making the fadeOutIn, in the frame that the text is not visible, make this:

That will change the text when is not visible, and then will run the fadeOut animation

This code is crap, sorry... U get something?