A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Movieclip rotation to 360 degrees?

  1. #1
    Senior Member
    Join Date
    Jul 2004
    Posts
    264

    Movieclip rotation to 360 degrees?

    Hi guys,

    I know this should be simple! It's driving me nut's that i've had to ask this question!!! I've searched google, searched the board -- but i cannot work it out.


    trace(myMovieClip..rotation) is returning the -180 for left side and +180 for right side


    How do i get this rotation to be out of 360 degrees?


    Thanks so much for the help!

  2. #2
    Junior Member
    Join Date
    Aug 2012
    Posts
    6
    hey, if you want to use from 0 to 360, you can always convert it with a function like

    function toFlashRotation(value:Number):Number
    {
    return (value%360<180) ? value%360 : -(180 -(value%360 - 180)) ;
    }
    //trace(toFlashRotation(200)) = -160
    function fromFlashRotation(value:Number):Number
    {
    return (value>0) ? value : 180 + (180 -Math.abs(value)) ;
    }
    //trace(fromFlashRotation(-175)) = 185

  3. #3
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    To explain why you get -180 to 180:

    Your using the rotation property of a diplayObject. Values of that are -180 to 180. Values outside this range are added to or subtracted from 360 to obtain a value within the range.

    This applies to all other rotation properties as well, ie. rotationX, rotationY etc.
    [SIGPIC][/SIGPIC]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center