Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-12-2012, 03:19 PM   #1
joe_hastings
Registered User
 
Join Date: Apr 2012
Posts: 10
Question touch screen image scroller

I want to create a set of images that will scroll left and right using touch screen input for an iPhone. Im pretty new to AS3, this is what ive come up with so far, it doesnt seem to move the images at all though:

(_1 to _4 are mc containers with the images in)

Code:
Multitouch.inputMode = MultitouchInputMode.GESTURE;

_1.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
_2.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
_3.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
_4.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);

function onSwipe (e:TransformGestureEvent):void{
	if (e.offsetX == 1) { 
	//User swiped towards right
	_1.x += 100;
	_2.x += 100;
	_3.x += 100;
	_4.x += 100;
	}
	if (e.offsetX == -1) { 
	//User swiped towards left
	_1.x -= 100;
	_2.x -= 100;
	_3.x -= 100;
	_4.x -= 100;
	} 
}
any ideas what needs adding?
joe_hastings is offline   Reply With Quote
Old 04-27-2012, 03:48 PM   #2
FusionFactor
Senior Member
 
FusionFactor's Avatar
 
Join Date: Jun 2011
Posts: 177
Default

Are you testing this on your computer or a mobile device? When I created AIR for iOS apps, I needed to replace all of the TransformGestureEvents with MouseEvents. Try compiling to an iOS or Android device, and see if it works there.
FusionFactor is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:12 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.