}
the event cause an issue with messages bellow
- Uncaught TypeError: actor.animate is not a function
- Uncaught TypeError: child.findActorAtPosition is not a function
or at least, no error, but the zOrder stay unchanged.
now... check the setZOrder in caat.js
--------------------------------------
setZOrder : function( actor, index ) {
var actorPos= this.findChild(actor);
// the actor is present
if ( -1!==actorPos ) {
// trivial reject.
if ( index===actorPos ) {
return;
}
if ( index>=this.childrenList.length ) {
this.childrenList.splice(actorPos,1);
this.childrenList.push(actor);
} else {
var nActor= this.childrenList.splice(actorPos,1);
if ( index<0 ) {
index=0;
} else if ( index>this.childrenList.length ) {
index= this.childrenList.length;
}
//-- ERROR is HERE ---> this.childrenList.splice( index, 1, nActor );
this.childrenList.splice( index, 0,nActor[0] ); // Correction
}
}
}
};
------------------------------------
this.childrenList.splice( index, 1, nActor );
replaces 1 element of children by an element that is an array (not elements inside the array !)
Solution :
nActor is always sized to 1 (see : var nActor= this.childrenList.splice(actorPos,1);)
so, the correct inserting way is
this.childrenList.splice( index Where Replace , 0 (and not >0 !!!, see javacript > 1.2 documentation) , nActor[0] (the element, not the array );
----------------------------------------
tested in scene, or containerActor, works as expected like a charm !
Can someone confirm ?