Jump to content
Search Community
Buzzafett test
Moderator Tag

Recommended Posts

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);
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...