Oh dear 🙁 This one really can mess up a game or application if you are publishing for Flash 6 player (or 7 in depending on coding restrictions), or at least have you stumped for a few minutes…..
Your mx.transitions.Tween’s can simply stop responding, or even better, your sprites dissappear (depending on the order the following occurs).
Here’s an illustrated problem:
This can occur in a purely AS2 (class based app), but I’m going to simplify it for now and put in some timeline based code. If you are using the Tween class to perform some animation, for example, I have a “ball_mc” on stage. I use the following on the timeline:
import mx.transitions.Tween; import mx.transitions.easing.Bounce; attachMovie("ball_mc", "ball_mc", 1); var t:Tween = new Tween(ball_mc,"_x",Bounce.easeOut,0,99,30,false); t.start();
Works a treat. Now imagine I’m running some game, placing “balls” on screen at various incremental depths (I’m not using getNextHighestDepth() because its Flash Player 6), some how my depth counter gets to the magic 9876:
import mx.transitions.Tween; import mx.transitions.easing.Bounce; attachMovie("ball_mc", "ball_mc", 9876); var t:Tween = new Tween(ball_mc,"_x",Bounce.easeOut,0,99,30,false); t.start();
Now our ball dissappears, it’s depth, overwritten. Seems that mx.transitions.OnEnterFrameBeacon uses depth 9876 for it’s own, and no-one else can have it! Ar har har!
Oh well, another depth that needs to be checked on from time to time, put that one on top of the list that v2 components reserve when it comes to getNextHighestDepth() :p