Hi, I'm using this code for a movie to follow mouse and nest when it leaves the stage. The movie is a hand and I need it to be a left hand on the left of the stage then nest while the right hand becomes active on the other side. Any help would be gratefully appreciated.
var targetX:Number;
var targetY:Number;
var sp:Sprite = new Sprite();
with(sp.graphics){
beginFill(0x000000);
drawRect(0,0,stage.stageWidth,stage.stageHeight);
endFill();
}
addChild(sp);
sp.alpha = 0;
sp.addEventListener(MouseEvent.MOUSE_MOVE,updateTargetF)
stage.addEventListener(Event.MOUSE_LEAVE,nestF);
function updateTargetF(e:MouseEvent) {
targetX=mouseX;
targetY=mouseY;
trace(targetX);
}
function nestF(e:Event) {
targetX=150;
targetY=700;
}
stage.addEventListener(Event.ENTER_FRAME,followBall);
function followBall(event:Event):void {
var dx:int = hand_mc.x - targetX;
var dy:int = hand_mc.y - targetY;
hand_mc.x -= dx / 5;
hand_mc.y -= dy /5;
}
if ... else mouse follow help.
Page 1 of 1|
|

New Topic/Question
Reply


MultiQuote


|