PDA

View Full Version : Questions on Varibles



way0end
July 31st, 2002, 11:34 PM
a varible is declared and initialized on main stage...
how do you access this varible through a symbol? i.e while you are editing the symbol..

a varible is declared and initialized on a symbol...
how do you access this varible on main stage? i.e. while you are in main...


this is confusing little, but, can someone please clear it to me?

:
::
::::Thank:::::::::::::::::::::::::::::::::::::::->>>you.
::
:

Iammontoya
July 31st, 2002, 11:45 PM
I'm not sure I understand your question, but..

variables on the main stage are best accessed using

_root.variablename

variables inside a symbol (movieclip or button) are accessed using

instancename.variablename

hope that helps.

way0end
August 1st, 2002, 12:24 AM
imagine this:

i make a new Movie Symbol called "Something", with a box in it.

while inside editing the symbol, i add three keyframes:
on keyframe 1, i add: a = 0;
on keyframe 2, i add: a++;
on keyframe 3, i add: while(a < 100){gotoAndPlay(2);};

now i am out of "Something" back to main stage.
and i put an instance of "Something" on stage.

::here is the point::

on main stage, i add a input text called "text";

somehow, i want this "text" show the value of 'a' on "Something".

and the other way around, if i wanted to see a varible on main stage thorugh a movie clip, such as an input text on "Something" to show a varible on main stage...

__________________________________________________ _
----------------------------------------------------------------------------------

i know something i'm doing wrong, or understanding wrong, that is why it's not working... as i tried so many variation..

_root.Something.a; not worked...
_root.Something:a; not worked...
_root:Something:a; not worked...

please help...
thanks...

-----------------------------------------------------------------------------------
__________________________________________________ __

way0end
August 1st, 2002, 05:12 AM
ok, i finally got somewhere through some research...
but only a part of this Post...

to access a variable on main stage from within a movie clip you use:

_parent.variablename;

........

i am still waiting for a reply on how to get to a variable declared inside a movie clip from within main stage.. the _root.

please if you got some idea reply....

thanks many times.

KarenInPA
August 1st, 2002, 07:56 AM
Hi,

I'm not sure I understand the question either, but the following may help you:

Instead of using an input text field, you could try a dynamic text field, with the variable _root.Something.a specified.

Instead of the while loop, you could try an if statement:
frame 1: a = 0;
frame 2: a++;
frame 3: if(a < 100) {
gotoAndPlay(2)
} else {
stop();
}

Ensure that the instance of movie clip "Something" is named "Something"

Good luck