A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Help with moving depth of "myself" upwards

  1. #1
    Senior Member
    Join Date
    Mar 2003
    Posts
    233

    Help with moving depth of "myself" upwards

    A/S 2

    Hi all,
    I am hoping to get some code for making this work...

    Basically I have a bunch of movie clips on the main timeline which all act as buttons (all uniquely named)

    Inside these movie clips is a button symbol with the actions on it to control the buttons behaviour.

    The movie clips overlap each other on the stage, so I want to put in some code (preferably the same code in each clip) to say "when you rollover me, move me upwards in depth so I am at the top)

    Then obviously if I rollover another button next to this one, then the same would happen, only higher.

    getNextHighestDepth seems to be the way to go, but I cant seem to get the paths right, I guess I am targetting "larent"?

    Any help would be much appreciated

    Thanks alot

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    post for the roll over part

    if on frame:

    Actionscript Code:
    mc.onRollOver = function(){
        this.swapDepths(getNextHighestDepth());
    }

    if directly on Movieclip:

    Actionscript Code:
    on(rollOver){
        this.swapDepths(getNextHighestDepth());
    }

    if on frame inside Movieclip:

    Actionscript Code:
    this.onRollOver = function(){
        this.swapDepths(this._parent.getNextHighestDepth());
        // or if this is on the _root frame, _root.getNextHighestDepth()
    }

    Hope one of those works
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Senior Member
    Join Date
    Mar 2003
    Posts
    233
    Thanks for the suggestion. Some of these work, but have a knock-on effect...

    Once I have rolled over the button once and had its depth changed, it is then unable to be targetted with the following code in another part of the movie:

    _root.btn_blue._visible = 0;

    Would the depth change mess with the targeting like this? Seems odd to me.

    Removing all the depth swapping code makes these visibility settings work again. Any ideas?

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Shouldn't be a problem, wanna post your FLA file?
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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