PDA

View Full Version : Using levels (edited title)



krackle808
March 10th, 2002, 06:02 AM
Hi, I'm using the scrollable Textbox thingy for a webpage I'm making. The problem I have is that my buttons are in a movie clip that are 1 level lower than my scrollableText box. So when I add actions to my buttons to change the scrollableText variable, what do i do? I tried.
On release _root.scrollableText = "blah"
but that didn't work. i also tried scrollableText = "blah" that didn't work.
Thanks
-Jon

sinfiniti
March 10th, 2002, 07:41 AM
since you are talking about 'levels' i am assuming that you are using loadMovieNum.
you can control levels just like movie clips.
ex:
to control level 15...
_level15.gotoAndPlay("level15_rules");
to control a movie clip on level 15...
_level15.mcMyMovieClip.gotoAndPlay("i_live_in_level15");

'_root' is relative to the level that contains it. some people make the mistake of thinking that '_root' and '_level0' are interchangeable....they are not.
:)
jeremy

ilyaslamasse
March 10th, 2002, 07:48 AM
I'm not sure I understand.
'_root' is relative to the level that contains it What's the correct as then : _root._level1.variable or _level1._root.variable ? I always believed that it was the first one but your sentence leads me to think otherwise.

pom 0]

eyezberg
March 10th, 2002, 08:16 AM
Nope, _root.level1 makes no sense, it's as if saying level0.level1, and you can't be on both!
First pick a level you wanna work in, then pich the clip/target. And indeed, _root will act as the base level of the clip in the level you chose, while _root by itself will be level0's _root...this was just to confiuze all of ya, hehe

ilyaslamasse
March 10th, 2002, 08:31 AM
And you succeded admirably, Eyez !
pom 0]

sinfiniti
March 10th, 2002, 04:15 PM
eyez, that is not totally correct....
_root is the lowest level of the swf that contains the object referring to _root.
_root by itself is NOT _level0 unless the you are referring to _root from within _level0.
_level0 is the first swf loaded into the player, and everything loaded into _level0 is a part of _level0. if you load a movie into a target in _level0, and that clip refers to _root, then it is referring to _level0. if you load a movie into _level5, everything in that level that refers to _root is referring to _level5 - even if you load a movie into a target in _level5.
basically _root is relative and _level is absolute.
:)
jeremy

ilyaslamasse
March 10th, 2002, 05:01 PM
Let's see if I get this :
Il load my movie in level 5. If I want some data located in the _root of my main movie, that is to say level 0, I'll have to access it with _level0. and that's it. No _root.

Is that right ?

pom 0]
I'm making this a best of Kirupa right now !! Well not right now, but when it's finished...

sinfiniti
March 10th, 2002, 07:20 PM
that is exactly it, pom!!
you have to use the level when controlling variables or clips in different levels.
as a matter of fact, flash relies solely on the level of swf's when it 'thinks' about movie clips, variables, etc.
to test this, just make a new movie in flash and put this in the first frame:
trace (targetPath(_root));
then test movie.
in the output window, it should say '_level0'. now, if you made another movie that loads that movie into level 15 and tested that movie you would get '_level15' in the output window, even though the trace says '_root' in the targetPath.
:)
jeremy

eyezberg
March 10th, 2002, 07:26 PM
This is so funny.._root, level0, main Movie, target clip..imagine a beginner reading this and pulling his hair out! Where the hell am I, in the basement, 1st floor or ceiling? Why is _root sometimes _root and sometimes level0? LOL! (I know it's not, sinfinity, it's just so hilarious..)

sinfiniti
March 10th, 2002, 09:39 PM
that's the confusing thing....sometimes _root is _level0!
:P
i think we scared everyone away!
:)
jeremy