Hey guys, I am working on an IOS app and I have a dial on the screen that I want to limit its rotation to 180 degrees in both clockwise and anti clockwise, I have the following code which works for anti clockwise but when i go clockwise you can rotate the dial as much as you want, its not limited to the 180 degrees.
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.events.TransformGestureEvent;
import flash.events.GestureEvent;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
Dial_mc.Grip_Bar_mc.addEventListener(TransformGestureEvent.GESTURE_ROTATE, onRotate);
function onRotate(e:TransformGestureEvent):void
{
Dial_mc.Grip_Bar_mc.rotation += e.rotation;
if (Dial_mc.Grip_Bar_mc.rotation > 180)
{
Dial_mc.Grip_Bar_mc.rotation = 180;
}
if (Dial_mc.Grip_Bar_mc.rotation < 0)
{
Dial_mc.Grip_Bar_mc.rotation = 0;
}
}
Also on a side note I was wondering if any one could help with how i can trace the rotation so I can make something happen if its going clockwise or anti clockwise like have a text field say which direction the dial is rotating?
Thanks for the help I have been trying to figure this out for a bit.