views:

114

answers:

1

I've a fairly simple little cs4 project where my desired effect is a clock face rotating in 3d space to match where the mouse is on the stage, but, for some reason, in order for the clock face to seek out the mouse position, I have to click the stage. Is this happening for anyone else? And, if so, why?

import caurina.transitions.Tweener;

var pp:PerspectiveProjection=new PerspectiveProjection();
pp.projectionCenter = new Point(225,250);
pp.fieldOfView = 55;
clock.transform.perspectiveProjection = pp;


addEventListener(Event.ENTER_FRAME, rotateClock);

function rotateClock(e:Event):void
{
    var xPcent:Number = mouseX/225;
    var yPcent:Number = mouseY/250;
    Tweener.addTween(clock, {rotationY:50 - (50*xPcent), rotationX:50 - (50*yPcent), time:2, transition:"easeOutCubic"});
}
+1  A: 

Try adding a MouseEvent.MOUSE_MOVE event to the stage instead.

Typeoneerror
Well, that was easy...
Jascha
Hehe. Glad it works :)
Typeoneerror