A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: _rotation problem

  1. #1
    Member
    Join Date
    Sep 2003
    Location
    Christchurch
    Posts
    36

    _rotation problem

    Hi
    I have been using _rotation in a movie as follows:
    Line.onEnterFrame = function ()
    {
    if (this._rotation < 122)
    {
    this._rotation += 5.833333
    }
    };
    This works well until I want the movie clip Line to rotate more than 180 degrees (for 20 frames) and then stop.
    If I put say <182 in the above code the movie clip rotates continuously.
    I am sure there is an answer related to how Flash geometry works, but I don't seem to be able to come up with it.
    Or should I be using a different approach?
    I would appreciate any ideas.
    Regards

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    In Flash angles are measured from -180 degrees to +180 degrees. when the value goes above 180 it is wrapped around to the corresponding negative value.

    Hence the angle will always be less than 182.

    You could maybe try using something like,

    if (this._rotation > -177) {

    }

    to get the result you're looking for.

  3. #3
    Member
    Join Date
    Sep 2003
    Location
    Christchurch
    Posts
    36
    Thanks for that. Would I be correct in assuming that from 12 to 6 o'clock the angle will be between 0 and 180 degrees and from 6 to 12 between -180 to 0?

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Yep

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