Need help creating an iPhone style menu, similar to Angry Birds or Cut the Rope.
It needs to use either Adobe Gesture Events or Greensock ThrowProps.
I tried using the ThrowProps example, but I need it to stop on each menu item.
The code below uses swipe left/right Gesture Events and TweenLite, but I need help adding an overshoot to the first and last menu item.
Maybe by adding an 'if else' statement.
import com.greensock.*;
import com.greensock.easing.*
var offsetX:Number = 440;
// Swipe Gesture
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, swipeHandler);
function swipeHandler(event:TransformGestureEvent):void {
switch(event.offsetX){
// swipe left
case -1: {
TweenLite.to(mc, 1, {x:mc.x - offsetX, ease:Expo.easeOut});
break;
}
// swipe right
case 1: {
TweenLite.to(mc, 1, {x:mc.x + offsetX, ease:Expo.easeOut});
break;
}
}
}
stage.addEventListener(Event.ENTER_FRAME, traceXPosition);
function traceXPosition(evt:Event) {
trace("movieClip Position: " + mc.x);
}