A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: SwapDepths Problem

  1. #1
    Junior Member
    Join Date
    Sep 2004
    Location
    Netherlands
    Posts
    17

    SwapDepths Problem

    Hello,

    I made a map with a rollover animation on the different sections.
    My problem is that the map pieces are overlapping each other.
    I want the piece that animates, when the mouse rolls over, on top. I used
    this.swapDepths(1); but it is not working when i use it on every piece of map.

    The pieces of the map are all movieclips with the as code below on the first frame inside the movieclip.

    code:


    this.onEnterFrame = function()
    {
    this.hitTest(this._parent._xmouse, this._parent._ymouse, true) ? this.nextFrame() : this.prevFrame();
    };




    I also put the fla file as an atachement to this message.

    Hope someone can help me....

    Gr. RiAnimator
    Attached Files Attached Files
    _________
    Ri|Animator

  2. #2
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    Try setting the depth higher than 1........

    code:

    this.onEnterFrame = function() {
    this.hitTest(this._parent._xmouse, this._parent._ymouse, true) ? this.nextFrame() : this.prevFrame();
    this.swapDepths(9999);
    }


  3. #3
    Junior Member
    Join Date
    Sep 2004
    Location
    Netherlands
    Posts
    17
    That does not work either. It works for one piece of the map but the others will have the same depth so they are still all on the same level.

    I'm not a scripter but i can imagine something like the part that's selected going to swapdepth(1) and the others set to swapdepth(0)?! Don't know if this is possible!? And have no idea how to write the script but it sounds logical to me..... I think i somehow have to set all other pieces to a lower level.

    Anyone?
    _________
    Ri|Animator

  4. #4
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    Maybe something like....
    code:

    this.onEnterFrame = function() {
    if(this.hitTest(this._parent._xmouse, this._parent._ymouse, true){
    this.swapDepths(9999);
    this.nextFrame()
    }else{
    this.swapDepths(10);
    this.prevFrame();
    }
    }



    Maybe post a demo file if this doesn't work.

  5. #5
    Member
    Join Date
    Dec 2004
    Posts
    49
    It should work.. except for the small typo:
    if (this.hitTest(this._parent._xmouse, this._parent._ymouse, true) {
    should be :

    if (this.hitTest(this._parent._xmouse, this._parent._ymouse, true)) {

  6. #6
    Junior Member
    Join Date
    Sep 2004
    Location
    Netherlands
    Posts
    17
    Thank's a lot! It works great!!!

    Gr.
    _________
    Ri|Animator

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