hi, i have these lines of code, when i try them alone it works fine but when i try to use it in my project it stop working, the rotation actually and is because of “this” in the tweener.
import com.greensock.*
var myMC:MovieClip = new MovieClip();
myMC.graphics.beginFill(0x00ff00);
myMC.graphics.drawRect(0, 0, 400, 300);
myMC.graphics.endFill();
myMC.x = myMC.y = 00;
addChild(myMC);
var targetRotation:int = 0;
var currentRotation:Number = myMC.rotation;
myMC.addEventListener(MouseEvent.MOUSE_DOWN, drag);
function drag(e:MouseEvent) {
myMC.startDrag();
this.stage.addEventListener(MouseEvent.MOUSE_UP, drop);
}
function drop(e:MouseEvent) {
this.stage.removeEventListener(MouseEvent.MOUSE_UP, drop);
myMC.stopDrag();
myMC.x = myMC.y = 00;
}
this.addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event) {
if (myMC.x != 0) {
targetRotation += myMC.x / 60;
TweenMax.to(this, 5, {currentRotation:targetRotation, onUpdate:applyRotation});
}
}
function applyRotation():void {
myMC.rotation = currentRotation;
}
my question is, is there any way to reference another object in the tweener to make this thing works? project consist in several classes wich are called by a fla to ensamble interface, maybe that’s the reason it stop working. thanks a lot i n advance for any help.
now i noticed the code i have just works directly on the fla, if i place it in a clase it stop working because of the same…“this”