Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example for drag and zoom and rotate. all together with gestouch #94

Open
mhr1019 opened this issue Nov 3, 2015 · 10 comments
Open

example for drag and zoom and rotate. all together with gestouch #94

mhr1019 opened this issue Nov 3, 2015 · 10 comments

Comments

@mhr1019
Copy link

mhr1019 commented Nov 3, 2015

can you send me a example witch an image drag , zoom and rotate into it?
thanks for helping me

@mhr1019
Copy link
Author

mhr1019 commented Nov 3, 2015

thanks but i want to use it in flash cs6 !!
is it possible???? :/
how??

@fljot
Copy link
Owner

fljot commented Nov 3, 2015

@mhr1019
yeah, possible. What seems to be impossible? See how gesture is created, how event handlers added and stuff? All same ActionScript.

@mhr1019
Copy link
Author

mhr1019 commented Nov 4, 2015

thank a lott @fljot
i wrote this code and i can drag the map (movieclip) but i can't zoom or rotate it. :(

Code:
import org.gestouch.events.GestureEvent;
import org.gestouch.gestures.TransformGesture;

var transformGesture:TransformGesture;

transformGesture = new TransformGesture(map);
transformGesture.addEventListener(org.gestouch.events.GestureEvent.GESTURE_BEGAN, onGesture);
transformGesture.addEventListener(org.gestouch.events.GestureEvent.GESTURE_CHANGED, onGesture);

function onGesture(event:org.gestouch.events.GestureEvent):void
{
var gesture:TransformGesture = event.target as TransformGesture;
var matrix:Matrix = map.transform.matrix;

matrix.translate(gesture.offsetX, gesture.offsetY);
map.transform.matrix = matrix;

if (gesture.scale != 1 || gesture.rotation != 0)
{
    // Scale and rotation.
    var transformPoint:Point = matrix.transformPoint(map.globalToLocal(gesture.location));
    matrix.translate(-transformPoint.x, -transformPoint.y);
    matrix.rotate(gesture.rotation);
    matrix.scale(gesture.scale, gesture.scale);
    matrix.translate(transformPoint.x, transformPoint.y);
    map.transform.matrix = matrix;
}

}

@fljot
Copy link
Owner

fljot commented Nov 4, 2015

@mhr1019
apparently gesture doesn't receive 2nd touch. Given the fact that you had questions and dealing with Flash CS – I guess you might be using some Adobe simulator with their "gestures"?

@mhr1019
Copy link
Author

mhr1019 commented Nov 4, 2015

thanks @fljot
i have a touch frame on my monitor and i have not using any simulator. you mean i can't drag(single touch) and zoom (multi touch) with this code? :(

@mhr1019
Copy link
Author

mhr1019 commented Nov 4, 2015

if you send me a source (.fla) file that can deal with all i want (drag,zoom,rotate with touch) I think the problem will be solved.
thanks

@fljot
Copy link
Owner

fljot commented Nov 4, 2015

@mhr1019
I don't have Flash CS to work with fla files.
Try to compile against sources, use this branch https://github.com/fljot/Gestouch/tree/features/71-fix-initialization

  1. You will need to configure conditional compilation (google it) with -define+=CONFIG::GestouchDebug,true to see bunch of logs which will help to understand what happens
  2. There are small changes in this branch regarding configuration/initialization. see here https://github.com/fljot/Gestouch/blob/features/71-fix-initialization/CHANGELOG.md

Most likely flash runtime doesn't understand that you can receive touch events, therefore Gestouch input part doesn't even listen to those. But this is configurable, no worries.

@mhr1019
Copy link
Author

mhr1019 commented Nov 7, 2015

thanks @fljot
i'm sorry but i'm a beginner and i don't understand what you saying.
can you explain that step by step and tell me what have to do exactly?
my app is most be in adobe flash CS6 and work with gestouch
please help me :(((

@fljot
Copy link
Owner

fljot commented Nov 7, 2015

@mhr1019
these are all basics. I can't afford wasting time on teaching you that, sorry. Learn something yourself or hire person to teach you or do the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants