all groups > flash actionscript > august 2007 >
You're in the

flash actionscript

group:

loadMovie and controlling depth


loadMovie and controlling depth BSciascia
8/28/2007 11:52:10 PM
flash actionscript:
I have been searching endlessly but others don't seem to be having this problem
so it must be very simple.

I have some text animation in my advertising banner and I would like to load a
movie so it appears under the text - to get around the 20kb size restriction of
the banner ad.

I can load the movie but it always appears on top of the text - so the text
does not appear. I thought the movie would inherit the layer position from the
target movie but it doesn't.

Here is the code I'm using on frame 1 of the banner ad to load the movie:
loadMovie("http://www.5678.co.nz/highlands/augsep2007/1/pic1.swf",
_root.pictarget);

Very limited action script experience so go easy!

Any help would be much appreciated.

Cheers

Re: loadMovie and controlling depth kglad
8/28/2007 11:56:47 PM
you can use depths to control the z-axis layering. items placed on-stage in
the authoring environment are at approximately depth - 2**16.

you can convert items to movieclips and use swapDepths() to more easily
control the z-layering.
Re: loadMovie and controlling depth BSciascia
8/29/2007 1:34:00 AM
Thanks for your reply!

I'm just having trouble making it work (and finding information regarding its
usage for the loadMovie action). I don't really understand what I'm doing sorry.

I've been trying:
loadMovie("http://www.5678.co.nz/highlands/augsep2007/1/pic1.swf",
_root.pictarget, depth-10);

and:
loadMovie("http://www.5678.co.nz/highlands/augsep2007/1/pic1.swf",
_root.pictarget, depth1);

and:
loadMovie("http://www.5678.co.nz/highlands/augsep2007/1/pic1.swf", _depth-1);

Re: loadMovie and controlling depth BSciascia
8/29/2007 1:43:44 AM
If I put in:
loadMovie("http://www.5678.co.nz/highlands/augsep2007/1/pic1.swf", _depth1);

The movie plays but over my button object as the curser doesn't change when
mousing over.

If I use:
loadMovie("http://www.5678.co.nz/highlands/augsep2007/1/pic1.swf", _depth-20);

The cursr changes but the movie doesn't play.
Re: loadMovie and controlling depth kglad
8/29/2007 2:33:04 AM
you can't load into a depth. you can load into a _level, but that's a topic
likely to confuse you more than you already are confused.

load your swf into a target movieclip. if you only need to position that swf
below your text try:



targetMC.swapDepths(-16273); // and see if that does what you want - where
targetMC is the load target.
Re: loadMovie and controlling depth BSciascia
8/29/2007 3:55:01 AM
Sorry about this, I just can't get my head around the sytax or how to add extra
modifiers on the end of a command.

Have tried:
loadMovie("http://www.5678.co.nz/matarangi/sept2007/1/movie1.swf",
_root.pictarget.swapDepths(-16273);

And:
loadMovie("http://www.5678.co.nz/matarangi/sept2007/1/movie1.swf",
_root.pictarget, swapDepths(-16273);

And:
loadMovie("http://www.5678.co.nz/matarangi/sept2007/1/movie1.swf",
_pictarget.swapDepths(-16273);
Re: loadMovie and controlling depth BSciascia
8/29/2007 3:56:27 AM
missing a ")"

Re: loadMovie and controlling depth BSciascia
8/29/2007 4:13:08 AM
Unfortunately, it still doesn't work. Maybe I'm going about this all wrong.

I have a movie that has all the text, images and animation:
http://www.5678.co.nz/matarangi/sept2007/1/movie2.swf

I then have another flash file that has 3 layers in it.
- Bottom Layer: the action that loads the above movie
- Middle Layer: the pictarget = target for movie that loads in
- Top Layer: the button target with a standard "getURL (clickTAG, "_blank");"
script on it.

I'm trying to get the external movie to load under the button layer so users
can use the getURL button.

Putting the button into the first movie (the one with all the animation) works
but as this is not the file that will be supplied to the website, they'll
probably reject it because it doesn't have a clickTAG in it.

Hopefully what I'm doing is easy - for some reason I think it should be!

Any help would be very much appreciated.

Cheers
Re: loadMovie and controlling depth BSciascia
8/29/2007 4:33:25 AM
Also been trying:
loadMovie("http://www.5678.co.nz/matarangi/sept2007/1/movie2.swf", _root.pictarget);
Re: loadMovie and controlling depth BSciascia
8/29/2007 4:55:19 AM
When you say 'load target", is that the symbol in my movie called "pictarget" or is that the actual movie I'm loading? i.e: "movie2.swf"

Re: loadMovie and controlling depth kglad
8/29/2007 5:18:28 AM
convert your text to a movieclip and give it an instance name, say textMC.
_root.pictarget is the load target. you can use:



loadMovie("http://www.5678.co.nz/matarangi/sept2007/1/movie2.swf",
_root.pictarget);
_root.pictarget.swapDepths(textMC.getDepth()-1);
Re: loadMovie and controlling depth BSciascia
8/29/2007 8:05:21 PM
OK, I decided to put all the text onto the pictures or into the movie I'm
loading. The only issue I'm having now, is that the movie I'm loading in, is
loading over the top of the button that has the clickTag.

I followed your seggestion and gave my button symbol an instance name of
'buttonMC' then used the following code but the button dosn't seem visable:


loadMovie("http://www.5678.co.nz/matarangi/sept2007/1/movie2.swf",
_root.pictarget);
_root.pictarget.swapDepths(buttonMC.getDepth()-1);
Re: loadMovie and controlling depth FlashForumName
8/29/2007 8:20:02 PM
If you're just trying to get the button instance on top of the movie clip
instance, I think something like this should work:



if(moveclipInstance.getDepth() > buttonInstance.getDepth()) // if movieclip is
above button, swap
{
temp = buttonInstance.getDepth();
temp2 = movieclipInstance.getDepth();
movieclipInstance.swapDepths(temp);
buttonInstance.swapDepths(temp2);
}
// if I recall correctly, higher # on depth stacks on top...otherwise it's the
other way around
Re: loadMovie and controlling depth BSciascia
8/29/2007 8:24:22 PM
I guess I'm not applying the instance name correctly?

Re: loadMovie and controlling depth BSciascia
8/29/2007 8:34:39 PM
Thanks for the reply. I realized that my movie target didn't have an instance
name as it was a graphic.

After converting it to a movie, the movie now loads under the button - thanks!
Unfortunately, the movie loads in all screwed up - stretched and cropped - any
suggestions?
Re: loadMovie and controlling depth FlashForumName
8/29/2007 8:38:18 PM
So it appears your button is named: buttonMC
and your movieclip is named: pictarget
If that is the case, I think putting something like this in after the load
should work assuming you always want your button to appear on top of the
movieclip:



if(buttonMC.getDepth() < pictarget.getDepth())
{
temp = buttonMC.getDepth();
temp2 = pictarget.getDepth();
buttonMC.swapDepths(temp2);
pictarget.getDepth(temp);
}
Re: loadMovie and controlling depth BSciascia
8/29/2007 8:38:58 PM
Got it, my movie target was a different size within the symbol, so was stretched on the stage.

Re: loadMovie and controlling depth kglad
8/29/2007 10:49:49 PM
Re: loadMovie and controlling depth BSciascia
8/31/2007 12:18:52 AM
Re: loadMovie and controlling depth kglad
8/31/2007 1:45:59 AM
AddThis Social Bookmark Button