-
Senior Member
AS explanation
code:
on (release) {
gotoAndStop(2);
_root.po.attachMovie("gun2", "gun2", this.getNextHighestDepth(), {_x:30, _y:0});
}
I want to know what
this.getNextHighestDepth()
does in this code
Thanks!
-
Senior Member
_root.po.attachMovie("gun2", "gun2", this.getNextHighestDepth(), {_x:30, _y:0});
the call attachMovie makes a new symbol by copying one from your library. The third argument (which getNextHighestDepth() is being used for) is the depth of the movie which controls layering. If two symbols are placed at the same depth, the second symbol obliterates the first one, so getNextHighestDepth() is used to insure that the symbol is placed on a unique depth, without obliterating any preexisting symbols, and it insures that the symbol is placed in front of any other symbols.
There's a possible mistake in the code, in that 'this' refers to the default timeline, but the movie is being attached to _root.po (which might not be the same thing). Since each timeline has it's own set of depths, you might want to use _root.po.getNextHighestDepth() instead of this.getNextHighestDepth().
-
Senior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|