dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: stacking order of movies

  1. #1
    Junior Member
    Join Date
    Feb 2004
    Posts
    8

    stacking order of movies

    i have two movies that are running at the same time and i want to change the stacking order depending on which one is clicked on. they are obviously both viewable at the same time and i would like one to go on top of the other when clicked. any ideas? i've tried using movieclip.swapDepths(), but with no luck.
    -skaflyer
    There are only 10 types of people in this world: those who understand binary and those who don't.

  2. #2
    Senior Member stoc's Avatar
    Join Date
    Nov 2001
    Location
    Romania, Arad
    Posts
    428
    code:

    curr_mc = a
    a.swapDepths(2)
    b.swapDepths(1)

    a.onPress = b.onPress = function(){
    if (curr_mc != this){
    trace (curr_mc)
    curr_mc.swapDepths(this)
    curr_mc = this
    }
    }

    Stoc Digital Studio - Web Applications Development
    http://www.stoc-studio.ro

  3. #3
    Junior Member
    Join Date
    Feb 2004
    Posts
    8
    can anyone help explain this code to me, i'm still new to actionscripting and i'm lost!
    -skaflyer
    There are only 10 types of people in this world: those who understand binary and those who don't.

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    419
    probably the easiest way to make this is to first create the windows, I'm assuming you are dynamically placing the windows onthe stage with a loop

    for(i = 0; i < 10; i++){
    this.attachMovie("someLink", "someName"+i; i);
    }

    a loop like this puts all the clips on depths 0 through 10, now think of a number bigger than ten, any number, I'll pick 60! now for each of your movies, have some actionscript then swaps with this depth.

    myMovie.onPress = function(){
    this.swapDepths(60);
    }

    it will always bring the one selected to the front!

  5. #5
    Junior Member
    Join Date
    Feb 2004
    Posts
    8
    ok, i think we have discovered where all my confusion is coming from. i know nothing of attaching movie clips. i have just created some movie clips by creating a new symbol -> movie clip. inside of each movie clip i have a sequence that start out with a button... it stops on that frame. when that button is clicked it goes through the rest of the frames... which causes the movie clip to blow up to cover the entire screen. each one of the movie clips are the same way. the problem is, when one with a lower z-index gets clicked, all the other movie clips are visible on top of it when it blows up instead of being behind it! i didn't create anything dynamically, i don't know how. if that's the course i need to go, then i guess i need to start over... but i truly do appreciate the help!
    -skaflyer
    There are only 10 types of people in this world: those who understand binary and those who don't.

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    419
    you still can do this, first make sure all the clips are on one single layer, then when clicked add the following code before all other code in the on click handler example

    Code:
    on(release){
    this.swapDepths(60);
    //....rest of the code
    }


    easy

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