PDA

View Full Version : Variable levels on loadMovie?


Charkocu
06-04-2007, 08:38 PM
Greetings!

I have a flash document where I need to allow the user to load up to 3 external movieClips, all on their own level.

The document itself (interface) is on level 0 (ofcourse). When they click a button, it loads a movieClip on level 1. When they click another button, I need it to recognize that level 1 is occupied, and to load onto level 2. When level 1 and 2 are occupied, I need the new loadedMovie to go to level 3. After that, whatever button they click will just override level 3.

In concept, I know this can work, but now I am clueless as to how to structure the script. What do I need the script to be on the button they click?

Thanks in advance!

_Hark

kgaard
06-04-2007, 09:50 PM
you'll probably want to use .getNextHighestDepth() -

do you have something started that we can take a look at to help you?

Charkocu
06-04-2007, 10:05 PM
Right now, my script is simple:

on (release) {
loadMovie("movies/myMovie.swf", 2);
}

So when a user clicks another button, it simply loads another movie, overriding the one already open. There are so many movies (its a gallery), I can't tell each button what level to place into, so its gotta place where there is one open.

I will try this code you gave me. But where do I plug it into what I have already?

Thanks for the reply!

atomic
06-05-2007, 12:36 AM
The correct syntax to load movies on levels is...

loadMovieNum("movies/myMovie.swf", 2);

As for checking if the level is already occupied, you can simply check the level's width. if it's larger than 0, then that level already has a movie loaded into it...

if(_level1._width > 0){
// Load on next level...
...
}

Charkocu
06-05-2007, 05:29 PM
I read in another forum about using something like this:

on (release) {
level = 1;
loadMovieNum("movies/myMovie.swf", level);
level ++;
}

I declare level = 1 (is that the right location to put this?) and then I assume the level ++ is some sort of additive command to add on top of the previous level? Unfortunately, it is not working...

What am I doing wrong? I appreciate the feedback thus far!

_Hark