Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Buzzafett

iPhone Swipe Menu

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

Just wondering, did you see the Panel-based scrolling demo that is shown in FAQ # 8 here:

http://www.greensock.com/throwprops/ ?

 

You can download the source and it doesn't require ThrowProps.

It will allow you to swipe between panels and if you try to flick beyond the last or first panel, it will bounce back.

Link to comment
Share on other sites

Thanks,

 

yes I saw that, but I need it to be used with a movie clip menu instead of loading in using XML.

Link to comment
Share on other sites

I was just in the middle of working it out, so thank you for posting this.

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.
×