Animate, Mobile Gesture "Pan Event" Problem

New Here ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

I have used the code snippet in Animate to create a "Pan Event" in my app. 

The code is: 

Multitouch.inputMode = MultitouchInputMode.GESTURE;
movieClip_2.addEventListener(TransformGestureEvent.GESTURE_PAN, fl_PanHandler_7);
function fl_PanHandler_7(event:TransformGestureEvent):void
{
event.currentTarget.x += event.offsetX;
event.currentTarget.y += event.offsetY;
}
 
When running a debug movie on it I can't do any panning
I also have "Pinch to Zoom Event" codesnippet on the same fill....that one works fine in simulator.
What to do?
 
 
 

 

Views

49

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

Hi.

 

This is odd because the code snippet adds the zoom listener to the stage but for some reason the runtime says that the stage doesn't implement scale... Anyway, try adding the zoom gesture to the main timeline instead.

function fl_PanHandler_7(event:TransformGestureEvent):void
{
	event.currentTarget.x += event.offsetX;
	event.currentTarget.y += event.offsetY;
}

function fl_ZoomHandler(event:TransformGestureEvent):void
{
	event.currentTarget.scaleX *= event.scaleX;
	event.currentTarget.scaleY *= event.scaleY;
}

Multitouch.inputMode = MultitouchInputMode.GESTURE;
movieClip_2.addEventListener(TransformGestureEvent.GESTURE_PAN, fl_PanHandler_7);
addEventListener(TransformGestureEvent.GESTURE_ZOOM, fl_ZoomHandler);

 

Please let us know if it works now.

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

LATEST
Hi JC
Thanks a lot for trying to solve my problem.
 
I inserted this code, your code:
 
Multitouch.inputMode = MultitouchInputMode.GESTURE;
Pan_mc .addEventListener(TransformGestureEvent.GESTURE_PAN,
fl_PanHandler); addEventListener(TransformGestureEvent.GESTURE_ZOOM, fl_ZoomHandler);
 
function fl_PanHandler(event:TransformGestureEvent):void
{
event.currentTarget.x += event.offsetX;
event.currentTarget.y += event.offsetY;
}
function fl_ZoomHandler(event:TransformGestureEvent):void
{
event.currentTarget.scaleX *= event.scaleX;
event.currentTarget.scaleY *= event.scaleY;
}
 
I did not get the desired panning effect. Insted my Pan_mc is now moving, in a straight line, from upper left, down to right while it zooms in (it gets bigger)
 
Regards 
Ove Hansen

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines