A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: swapdepths problem

  1. #1
    Member
    Join Date
    May 2006
    Posts
    48

    swapdepths problem

    Hì u all, here my situation:
    I have 4 mc on the stage (mc1,mc2..), each mc has a mc inside (in_mc1,in_mc2..) that onPress have to bring the respective mc on the front.

    first frame
    i=20;

    in the first frame of each mc I have
    in_mc.onPress=function(){
    _root.mc.swapdepths(i++);
    }

    this code brings the pressed mc on the top of the others, but if I have on top mc1, then mc2 and then mc3 and I press mc2 p.e happens that mc2 is on top but mc3 is over mc1.
    Anybody has an idea what's missing in my code???

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    ?? thats how its supposed to work..

    example:

    you click on mc1..it goes to depth "5" (we'll say)
    you click on the next MC (mc2) and it goes to depth 6.
    you click on mc 3..it will go to depth 7 still leaving mc2 on depth #6 and mc1 on depth #5...

    so if you click on mc 2 again (making it depth 8) you have still left mc1 on deth 5 which is lower/under than mc3 on depth 6...

    make sense??

  3. #3
    Member
    Join Date
    May 2006
    Posts
    48
    exactly!
    it seems I solved the problem changing the code this way:

    var i:Number = 20;

    mc1.in_mc1.onRelease = function(){
    _root.mc1.swapDepths(i++);
    }
    mc2.in_mc2.onRelease = function(){
    _root.mc2.swapDepths(i++);
    }
    mc3.in_mc3.onRelease = function(){
    _root.mc3.swapDepths(i++);
    }

    I don't really understand why this way it works, but it does..

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