Investigue y encontré otra manera un poco mas sucia que pude aprovechar para uno de mis Tips.! Por ello dejo aquí el código que emplee... Y de paso ensucio la BD de Clab con mis cosas:
Edit: Quite un pedazo con variables que ni el FSM utilizaba, y ademas agregue otras que no había declarado desde un principio por lo que devolvía error.
Edit2: Elimine un montón de variables sin sentido, ademas de redundancias en el código. Gracias por la iniciativa Bleend !
Edit3: Quite algunas variables mas (see, mas aun), que ni siquiera se utilizaban, no mucho al menos
Código ActionScript :
var mxx:Number, my:Number, mx0:Number, my0:Number, dmx:Number, dmy:Number; var addx:Number, addy:Number, inx:Number, iny:Number; var vr:Number, torque:Number, vx:Number, vy:Number; var r:Number, m:Number = 1, b:Number = 1.2; var time_mode:Boolean = false; var mode:Boolean = false; // inx = object.x; iny = object.y; r = object.rotation; vr = torque = vx = vy = addx = addy = 0; // object.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down); function mouse_down(enter:MouseEvent){time_mode = mode = true;} // stage.addEventListener(MouseEvent.MOUSE_UP, mouse_up); function mouse_up(enter:MouseEvent){mode = false; time_mode = true;} // addEventListener(Event.ENTER_FRAME, enter_frame); function enter_frame(event:Event){ if(mode){if(time_mode){ time_mode = false; mx0 = mxx = mouseX; my0 = my = mouseY; dmx = dmy = 0;}else{ my = (mouseY+my)/2; mxx = (mouseX+mxx)/2; dmx = mxx-mx0; dmy = my-my0; mx0 = mxx; my0 = my;} // var fx:Number = (dmx-vx)*m; var fy:Number = (dmy-vy)*m; var ldx:Number = mxx-inx; var ldy:Number = my-iny; // if(fx == 0){ var mlength:Number = ldx; var mforce:Number = fy; torque = mforce*mlength;}else if(fy == 0){ mlength = ldy; mforce = fx; torque = -(mforce)*mlength;}else{ var k:Number = fy/fx; var kx:Number = (-(k)*k*ldx+k*ldy)/(-(k)*k-1); var ky:Number = k*(kx-ldx)+ldy; mlength = Math.sqrt(kx*kx+ky*ky); mforce = Math.sqrt(fx*fx+fy*fy); // if(fx*ky>0){torque = -(mforce) * mlength;}else{torque = mforce * mlength;}} // vx = dmx; vy = dmy; inx += vx; iny += vy; vr = vr-torque / 900; ldx = mxx-inx; ldy = my-iny; var cos = Math.cos(vr/180 * Math.PI); var sin = Math.sin(vr/180 * Math.PI); addx = ldx*cos+ldy*sin-ldx; addy = -(ldx)*sin+ldy*cos-ldy; inx -= addx; iny -= addy;}else{if(time_mode){time_mode = false; vx -= addx; vy -= addy;} // torque = addx = addy = 0; inx += vx; iny += vy;} // object.rotation -= vr; //} object.x = inx; object.y = iny; vx /= b; vy /= b; vr /= b;};
Igual no esta de mas aclarar que el MC del stage al que dirigimos las acciones se tiene un nombre de instancia "object".