Hi, It seems that if I implement Chain AND Events in the same class,
Chain doesn't work anymore.
For exemple the class below works properly, but as soon as I add
Implements:Events, the chain methods don't work anymore. I need Events
because I want to fire out an event when the last fx of the chain is
complete.
I think i'm doing something wrong implementing the Events, so, can you
help me please?
////////////////////////////////////////
var Switcher = new Class({
Implements:Chain,
Implements:Events,
initialize:function(){
this.elem1 = null;
this.elem2 = null;
this.currentElement = null;
},
switchElements:function(elem1,elem2){
this.elem1 = $(elem1);
this.elem2 = (elem2) ? $(elem2) : null;
if(!elem2){
this.elem1.set('tween',{ link:'chain' });
this.showElement1(this.elem1);
}
else{
this.clearChain();
this.elem1.set('tween',{ link:'chain' });
this.elem2.set('tween',{ link:'chain',
onComplete:function()
{ this.callChain(); }.bindWithEvent(this) });
this.chain(
function(){ this.fadeElement2(); },
function(){ this.hideElement2(); },
function(){ this.showElement1(); }
);
this.callChain();
}
},
showElement1:function(){
this.elem1.setStyles({ 'opacity':'0','display':'block' }).tween('opacity',
1);
},
fadeElement2:function(){
this.elem2.tween('opacity',0);
},
hideElement2:function(){
this.elem2.setStyles({'display':'none'});
this.callChain();
}
///////
});