A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: AS explanation

  1. #1
    Senior Member Djali's Avatar
    Join Date
    Sep 2004
    Location
    Sweden, stockholm
    Posts
    124

    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!
    Area restricted-
    Tresspassers will be shot.
    Survivors will be shot again...


    http://www.geocities.com/legg3r

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    _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().

  3. #3
    Senior Member Djali's Avatar
    Join Date
    Sep 2004
    Location
    Sweden, stockholm
    Posts
    124
    Thanks!
    Area restricted-
    Tresspassers will be shot.
    Survivors will be shot again...


    http://www.geocities.com/legg3r

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center