all groups > flash actionscript > july 2004 >
You're in the

flash actionscript

group:

Passing Variables inside MC's


Passing Variables inside MC's ShckByte
7/27/2004 11:21:39 PM
flash actionscript:
Hey all,

I'm trying to pass my variable from an input text field to another MC by
copying the same input text field in an MC. I want the same info typed in to
show up on another page of the main movie. I'm not getting anything when doing
this. What am I doing wrong? Thanks!
Re: Passing Variables inside MC's mandingo
7/27/2004 11:49:20 PM
try something like this... :

myFirstInput.onChanged = function(){
_root.mySecondMC.mySecondInput.text = this.text;
}

that will make what appears in the text of one appear in the text of the other
simultaneaously

hth
cheers,
Re: Passing Variables inside MC's ShckByte
7/28/2004 12:04:44 AM
Ok, but what if, after looking at my movie, the input text fields aren't within
an MC, but on the main timeline, and in order to have the page that I want
printed it has to be an MC with the previously inputted text fields. Would this
still work?
Re: Passing Variables inside MC's mandingo
7/28/2004 12:17:35 AM
If you are leaving one frame and going to another where there is to be some
text displayed... then save the first as a variable...

on whatever button/clip/function that moves to the printing movieClip

myVar = myInputText.text;

then on the printing movieClip

myPrintText.text = myVar;

does that make sense?
Re: Passing Variables inside MC's ShckByte
7/28/2004 12:32:01 AM
Ok, so the input text on the main timeline has a variable set (let's say I name
it 40320A) and I go to an MC that will print this input text (because I'm
making the field bigger so the user will be able to read all of their text)
where exactly would I put the code to "remember" the variable from the
timeline? Thanks and sorry I seem a little dense;)
Re: Passing Variables inside MC's mandingo
7/28/2004 12:48:24 AM
Well for a start you won't name it 40320A... It is bad practice to begin any
named instance with a number... Flash doesn't like it at all...

What is going to take you to the print moveiClip?

if it is a button,

on(release){
var40320A = myInputField.text;
// plus the actions that go to the print area
}

then on the other movieClip, you just use that variable for the text in the
field
Re: Passing Variables inside MC's ShckByte
7/28/2004 12:53:14 AM
Re: Passing Variables inside MC's ShckByte
7/28/2004 12:53:20 AM
AddThis Social Bookmark Button