Thursday, June 7, 2012

[Action Script] custom registration point of a movieClip June,2012

I have an item instance name mcUpper (movieclip) with x =12 & y = 342.75 (width = 104.5 & Height = 110)

Prior On changing it to movieClip I set registration to middle left.

now i want to rotate mcUpper with keyboard keys w (ccw) and s (cw)

I achieved rotation successfully. That was smooth.

// this code is for ccw rotation. Same I wrote for cw rotation

stage.addEventListener(KeyboardEvent.KEY_DOWN,ccwR otationUpper);
function ccwRotationUpper(e:KeyboardEvent):void
{
//using key with keycode 87, 'w' key.
if (e.keyCode == 87)
{
mcUpper.rotation -= 2;
}
}

Now it is rotating ccw on pressing key w at the registration point I made up (middle left)

Now my Question.

Q. 1: I want the rotation to occur using same method above around point
x = 39.8, and y = 346.25. How can I do that??

Q-2: On keep pressing "w" key it rotates then stuck for a while then rotate again. Why? How can I get rid of this.

Many many thanks in advance.
custom registration point of a movieClip

Related Post



0 comments: