I’ve stripped out a bunch of other actions in my AS code to highlight the problem I’ve having.
In this example, I have a movie that uses mx.transitions to fade one movieclip out and another in when the user clicks a button.
bOnState is a variable that keeps track of which movieclip is “on”. true for one, false for the other. (works here…)
Anyway, if the button is clicked rapidly the transitions start tripping over one another and I can end up with both images faded up or vice versa. Essentially, it starts another transition before the first finishes.
**What’s the best way to know my transitions are complete since they’re not really frame-based? Make sense?
**
btButOne.onRelease = function ():Void {
if ((bOnState == false) || (bOnState == undefined)) {
bOnState = true;
fadeOut(mcRoad, .7);
fadeIn(mcPicRight, .5);
} else if (bOnState == true) {
bOnState = false;
fadeOut(mcPicRight, .5);
fadeIn(mcRoad, 1);
}
};
function fadeIn(mc, time):Void {
easeType = mx.transitions.easing.Strong.easeOut;
var begin = 0;
var end = 100;
varTrans = new mx.transitions.Tween(mc, "_alpha", easeType, begin, end, time, true);
}
function fadeOut(mc, time):Void {
easeType = mx.transitions.easing.Strong.easeOut;
var begin = 0;
var end = 100;
varTrans = new mx.transitions.Tween(mc, "_alpha", easeType, begin, end, time, true);
}