SwapDepth in numerical order!

  • Jack Sparrow
  • Beginner
  • Beginner
  • Jack Sparrow
  • Posts: 36

Post 3+ Months Ago

Hi, I'm working on a project and I've broken it down so it will be easier to manage. The first thing I want to do is:

I'd like to have 3 movieclips (more eventually but I'll start with 3) that are numbered, 1, 2, 3 in their instance name. They will each overlap.

I want a button that will, when pressed, change the stacking order of the movieclips in order of number. It will start with 1, and when the button is pressed number 2 will be placed above, and so on.

When number 3, or whatever the highest movie is, is above the others, I would like the process to start again, so that when the button is clicked, movie number 1 will have the highest stacking order, and so on.

This is just the first part of my project, and hopefully I'll learn alot from any help I get.

Thanks!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • LO_LA
  • Born
  • Born
  • LO_LA
  • Posts: 2

Post 3+ Months Ago

Maybe this will help, is swichting the level all the time......is in actionscript 3

Code: [ Select ]
var slideNum:int = 0;
var intialLevel:int = 0;
var maxSlides:int = 5;

for (var i:int = 0; i<maxSlides; i++) {
    if ( i < 2 ) {
        trace("loading in level " + i);
    } else {
        if (intialLevel == 0) {
            trace("loading in level " + intialLevel);
            intialLevel = 1;
        } else {
            trace("loading in level " + intialLevel);
            intialLevel = 0;
        }
    }
}
  1. var slideNum:int = 0;
  2. var intialLevel:int = 0;
  3. var maxSlides:int = 5;
  4. for (var i:int = 0; i<maxSlides; i++) {
  5.     if ( i < 2 ) {
  6.         trace("loading in level " + i);
  7.     } else {
  8.         if (intialLevel == 0) {
  9.             trace("loading in level " + intialLevel);
  10.             intialLevel = 1;
  11.         } else {
  12.             trace("loading in level " + intialLevel);
  13.             intialLevel = 0;
  14.         }
  15.     }
  16. }
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

you just have to keep track of an id number...

Code: [ Select ]
var currID:Number = 0; // or what ever number you want to start with
function doswap(){
var nextID = currID + 1;
var targ = pathToMc["mcName"+nextID];
targ.swapDepths(clip.getNextHighestDepth());
currID = nextID;
}

buttonName.onRelease = doswap;
  1. var currID:Number = 0; // or what ever number you want to start with
  2. function doswap(){
  3. var nextID = currID + 1;
  4. var targ = pathToMc["mcName"+nextID];
  5. targ.swapDepths(clip.getNextHighestDepth());
  6. currID = nextID;
  7. }
  8. buttonName.onRelease = doswap;


this assumes that you name all your clips numerically. IE clip0, clip1, clip2

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 18 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.