Hi All,
I have main movieClip which creates several instances of a library component each with a different id_number variable. The components are made listeners of the main movieClip so when it broadcasts moveComp(id_number,newX) only the matching component respond and moves to the new x location.
Everything works fine but the problem I have is trying get the tween class onMotionFinished to call a function either in the parent movieClip or a function in the component itself. What am I doing wrong? Can anyone help??
Many Thanks,
Ty
This is the relevant bit of the components script.
//---------8<-----
myCom.prototype.moveComp = function(compId, newX) {
if (compId == this.id_number) {
trace("moving component "+this.id_number);
var myTweenX = new Tween(this, "_x", Regular.easeOut, this._x, newX, 0.2, true);
myTweenX.onMotionFinished = function() {
// trace works but the id_number is undefned
trace(“move finished - ”+this.id_number);
// calling a ‘parent_mc’ function or a function in the component doesn’t work!!
this._parent.moveFinished(this.id_number);
this.moveFinished();
};
}
};
//
myComp.prototype.moveFinished = function() {
trace(“move finished - ”+this.id_number);
};
//---------8<-----