Swapping Depths Question

Hey all,

I’m testing out the following Kirupa tutorial:
http://www.kirupa.com/developer/actionscript/swapdepth.htm

I got my movie to work and it’s called green.swf…

Problem is I’m calling the green.swf within a different master movie and loading it via “loadMovie” command. But when I call green.swf from my master movie the windows within green.swf no longer swapDepths like they do within green.swf.

Menu_mc.One_btn.onRollOver = function () {
_root.content_mc.loadMovie(“swf/green.swf”);
};

I’m referencing the swapDepths within green.swf using the following code for three windows…green…red…blue…the example for red is below:

on (press, release, dragOver, dragOut) {
_root.x +=2;
_root.red.swapDepths(_root.x);
}

I figure I’m not referencing the mc in green.swf correctly when it comes into the master movie but I’m not sure how it should be referenced.

Any help is greatly appreciated…

Regards,

SKURGE

Maybe I have this wrong, but if you reference _root from a movie loaded into a parent movie, _root is the parent movie.

try changing

to [AS]on (press, release, dragOver, dragOut) {
_root.x +=2;
_root.content_mc.red.swapDepths(_root.x);[/AS]

Couldn’t you also use the _parent property?

yep, i just wrote it my way b/c it might help someone understand the exact targeting problem easier.

That works perfecty in the parent MC. THANKS!!

Is there anyway to compartmentalize the referencing so that the swapdepth call works nomatter their location or is the code you provided below the main way to do it and have it work when the mc is called from a parent movie?

Ex…
_root.content_mc.blue.swapDepths(_root.x);

imagine using _parent.mc as sort of a local reference, so it’s only going to work if the relationship between mc’s is correct. but the _root.mc.mc is more of an absolute reference. so it will work in more situations.

But I guess what your saying is that there really isn’t a way to reference it so that it works in all cases unless you have some variables in place and a procedure in place that will determine what variable to call depending on the location of where the MC is being called.

Do I understand it correctly?

Again thanks for your assistance!

SKURGE

yeah, i suppose using a variable like that would work. it would just be sort of unnecessary becuase you’d have to set up if statements, the variables, and still assign the variables the correct locations. it’s just easier to know the relative locations of your files and their relationships.