fljot / GestouchExamples

Examples for Gestouch library.
https://github.com/fljot/Gestouch
MIT License
58 stars 13 forks source link

Multiple Tap Listeners Programmatically #7

Open brycebigger opened 10 years ago

brycebigger commented 10 years ago

First off, let me say that Gestouch is amazing, works well in Flash, but even better, works well with Scaleform! In doing some FUI interfaces, it has been so easy to test and iterate. It's tough to do quick testing on iOS no matter what- the build/deploy process takes about a minute every time, so that adds up. Testing touch interfaces immediately with a touch monitor is super quick, but typically the cheap ones on have two simultaneous touch points, but I digress.

Here's my issue: I'm building a horizontal, scrolling menu that's populated with the same MovieClip, about 20 of them, so the movieclip container ends up being about 3000px wide. Enter a swipe gesture to make them go back and forth. Done. Now, to select an individual movieclip and get it's id, name, etc. is where I'm slipping up.

Here's my code:

for (var i:int = 0; i < numberOfNodesToAdd; i++) { var menuItem:MenuItem = new MenuItem(); /* skipping a bunch of formatting stuff */ var singleTap:TapGesture = new TapGesture(menuItem); singleTap.numTapsRequired = 1; singleTap.addEventListener(TapGestureEvent.GESTURE_TAP, menuItemTap);

//more code and then finally, container.addChild(menuItem);
}

private function menuItemTap(e:TapGestureEvent):void { //The line below doesn't work, but I'm not sure how to target it exactly... //TweenMax.to(e.currentTarget.bg, 1, {tint:0xff0000});

trace(e.currentTarget);  //returns object

}

This is a project I'm using the Flash IDE (CS6 and CC). Any thoughts/insight on how to figure out what I pressed? I'm sure I'm missing something simple...

Thanks! Bryce