Is there a way to forcefully finish a transition in progress?
I have a image loaded with a transition when user presses button, but if it presses it again too fast (and the next image is already in memory) then things go bad.
For example go to http://www.totolici.com/tst/ , enter any category on the left and press the + sign a few times to load a few images, then press the - button a few times FAST. You will see the fading transition is interrupted mid-way and affects all future images.
I would like either to be able to force the transition to 100% when pressing the button or to set the new transition to begin ONLY when the previous transition has finished.
Going nuts…
here’s the code:
import mx.transitions.Fade;
import mx.transitions.Fly;
import mx.transitions.easing.Elastic;
var nowLoaded:String = '';
var Holder_mc_0:MovieClip = this.createEmptyMovieClip("Holder_mc_0", 11);
var Holder_mc_1:MovieClip = this.createEmptyMovieClip("Holder_mc_1", 10);
var nextHolder:MovieClip = Holder_mc_0;
var thisHolder:MovieClip = Holder_mc_1;
var myMCL:MovieClipLoader = new (MovieClipLoader);
var myListener:Object = new (Object);
var newWidth:Number;
myListener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
prog_mc.progtext="loading: "+bytesLoaded+" / "+bytesTotal;
}
myListener.onLoadStart = function(target:MovieClip):Void {
prog_mc._visible=true;
mx.transitions.TransitionManager.start(nextHolder, {type:mx.transitions.Fade, direction:mx.transitions.Transition.OUT, duration:0.3, easing:None.easeNone});
};
myListener.onLoadComplete = function(target:MovieClip):Void {
prog_mc._visible=false;
};
myListener.onLoadInit = function(target:MovieClip):Void {
target._x=(634-target._width)/2;
mx.transitions.TransitionManager.start(target, {type:mx.transitions.Fade, direction:mx.transitions.Transition.IN, duration:0.3, easing:None.easeNone});
target._visible=true;
};
myMCL.addListener(myListener);
function loadme(img:String, lx:Number){
if (nowLoaded<>img){
if (nextHolder==Holder_mc_0)
{
nextHolder=Holder_mc_1;
thisHolder=Holder_mc_0;
}else{
nextHolder=Holder_mc_0;
thisHolder=Holder_mc_1;
};
thisHolder._visible=false;
myMCL.loadClip(img,thisHolder);
// thisHolder._x=lx;
thisHolder._y=9.5;
thisHolder.swapDepths(nextHolder);
nowLoaded=img;
}else{
mx.transitions.TransitionManager.start(thisHolder, {type:mx.transitions.Fade, direction:mx.transitions.Transition.IN, duration:0.3, easing:None.easeNone});
};
};
var tmbHolder_mc:MovieClip = this.createEmptyMovieClip("tmbHolder_mc",8);
tmbHolder_mc._x=67;
tmbHolder_mc._y=469.9;
var tmbMCL:MovieClipLoader = new (MovieClipLoader);
var tmbListener:Object = new (Object);
tmbListener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
prog_mc.progtext="loading: "+bytesLoaded+" / "+bytesTotal;
}
tmbListener.onLoadStart = function(target:MovieClip):Void {
prog_mc._visible=true;
};
tmbListener.onLoadComplete = function(target:MovieClip):Void {
prog_mc._visible=false;
};
tmbListener.onLoadInit = function(target:MovieClip):Void {
mx.transitions.TransitionManager.start(target, {type:mx.transitions.Fly, direction:Transition.IN, duration:0.3, easing:Elastic.easeOut, startPoint:8});
};
tmbMCL.addListener(tmbListener);
function tmbLoadme(tmb:String){
tmbMCL.loadClip(tmb,tmbHolder_mc);
};
stop();