krishna
krishna

Reputation: 9

360 degree rotation in flash actionscript 3

how to rotate an object 360 degree in as3 is any solution

Upvotes: 0

Views: 2717

Answers (2)

Glycerine
Glycerine

Reputation: 7347

(event.target as DisplayObject).rotation

This should really be ev.currentTarget.rotation as at times ev.target can refer to alternative object and cause errors. Plus this way, you correctly collecting the object 'as is' rather than trying to cast it to something it may not be.

For example - you could cast is as a DisplayObject (of which it is) but it may be a MovieClip.

Upvotes: 0

grapefrukt
grapefrukt

Reputation: 27045

Your question is very unspecific, but this is a way to animate a full rotation for a sprite:

// in your contstructor or somewhere equivalent
addEventListener(Event.ENTER_FRAME, handleEnterFrame);

// then add this function somewhere suitable
private function handleEnterFrame(e:Event):void{
    objectToRotate.rotation += 1;
}

Upvotes: 1

Related Questions