PDA

View Full Version : [AS2][CS3]Setting Depth before attachMovie



Skribble
February 10th, 2009, 10:09 AM
EXPLANATION:

So I am loading everything in my game primarily with attachMovie(); and assigning them specific depths, and all has been going fine until now.

I made a "fade" movieclip so I can fade in levels/menus/etc and I load it with a depth far greater than anything on the screen, and while it works, there is a slight problem.

When I call something and set its depth, it takes 1 frame to process, so I get a "flicker" of things on screen, then the next frame they are where they are meant to be. This results in a very shoddy looking fade sequence.

QUESTION:

Is there a way to set the depth of a movieclip before/as it is attached to the stage, as to avoid the flickering effect?


Thanks!

mpelland
February 10th, 2009, 10:57 AM
have you though of setting the initial alpha or visibility of the next (flickering) object to 0 (or false) when adding it to the stage, setting the depth and then making it visible.. kind of a hack but it is a quick hack

rrh
February 10th, 2009, 11:37 AM
myMovieClip .attachMovie( idName , newName , depth [, initObject ] )From here:
http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary508.html

So my simple answer is that yes, there is a way to set the depth of a movieclip as it is attached to the stage. But I feel like I'm missing something.

senocular
February 10th, 2009, 11:41 AM
There is no frame delay for setting depth. When you attach movie, its attached immediately at that depth. The delay might be caused by something else you're doing.

Skribble
February 10th, 2009, 10:30 PM
There is no frame delay for setting depth. When you attach movie, its attached immediately at that depth. The delay might be caused by something else you're doing.

Ahhh, that makes more sense.

Seems I'll have to dig through my code for a while.