Tuesday, 7 August 2012

rotating a movieClip with mouse in as3

Step 1: Draw a rectangle
Step 2: Convert to Symbol (press F8)
www.actionscriptguru.in



Step 3: Give it Instance Name is "mc"(press Ctrl+F3) and click OK
www.actionscriptguru.in


ActionScript:


import flash.events.Event;



function mcRotation(e:Event){

var angle=(Math.atan2(mouseY-mc.y,mouseX-mc.x))*180/Math.PI 

mc.rotation=angle
}
addEventListener(Event.ENTER_FRAME,mcRotation)

No comments:

Post a Comment