Tyler Richardson
Tyler Richardson

Reputation: 309

Rotating around completely in 90 degree intervals

I have a circular menu that rotates 90 degrees every time leftArrow_mc is clicked but at 270 degrees the button stops working. Also will the reseting the degrees back to 0 do anything for me?

    import com.greensock.*;
    import com.greensock.easing.*;

    leftArrow_mc.addEventListener(MouseEvent.CLICK, rotateLeft1);

    function rotateLeft1(event: MouseEvent):void {
if (bottomWheel_menu_mc.rotation==0) {
    TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 90, ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 90) {
    TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 180, ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 180) {
    TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 270, ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 270) {
    TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 360, ease:Bounce.easeOut});
}
else if (bottomWheel_menu_mc.rotation == 360) {
    bottomWheel_menu_mc.rotation == 0
}

}

Upvotes: 0

Views: 234

Answers (1)

joshua
joshua

Reputation: 684

heres your answer, it works.. If you need the working let me know..its late so im not sure why this behaves like it does but i would check into the property (rotation:) inside your tweens.

      import com.greensock.*;
      import com.greensock.easing.*;

     leftArrow_mc.addEventListener(MouseEvent.CLICK, rotateLeft1);

     function rotateLeft1(event: MouseEvent):void {
      if (bottomWheel_menu_mc.rotation==0) {
      TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 90, ease:Bounce.easeOut});
      } else if (bottomWheel_menu_mc.rotation == 90) {
      TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 180, ease:Bounce.easeOut});
      } else if (bottomWheel_menu_mc.rotation == 180) {
      TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 270, ease:Bounce.easeOut});
      } else if (bottomWheel_menu_mc.rotation == -90) {
      TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 0, ease:Bounce.easeOut});
      }
       trace( bottomWheel_menu_mc.rotation);
    }  

Upvotes: 1

Related Questions