A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Current target issue

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    2

    Current target issue

    Hello,

    I am trying to create an app where a user can drag, drop, pinch and zoom multiple photos on the stage, each one at a time. Below is the code I am using. This works correctly for drag and drop, but the two multi touch gestures don't work. No matter which object I select on stage, only the first object that was selected will be zoomed or rotated.

    Any help is appreciated.


    Code:
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    
    photo1_mc.addEventListener(TransformGestureEvent.GESTURE_ZOOM,onZoom);
    photo2_mc.addEventListener(TransformGestureEvent.GESTURE_ZOOM,onZoom);
    photo3_mc.addEventListener(TransformGestureEvent.GESTURE_ZOOM,onZoom);
    
    photo1_mc.addEventListener(TransformGestureEvent.GESTURE_ROTATE , onRotate);
    photo2_mc.addEventListener(TransformGestureEvent.GESTURE_ROTATE , onRotate);
    photo3_mc.addEventListener(TransformGestureEvent.GESTURE_ROTATE , onRotate);
    
    photo1_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragIt);
    photo2_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragIt);
    photo3_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragIt);
    
    photo1_mc.addEventListener(MouseEvent.MOUSE_UP,dropIt);
    photo2_mc.addEventListener(MouseEvent.MOUSE_UP,dropIt);
    photo3_mc.addEventListener(MouseEvent.MOUSE_UP,dropIt);
    
    function onZoom (e:TransformGestureEvent){
    	e.currentTarget.scaleX *= (e.scaleX+e.scaleY)/2; 
    	e.currentTarget.scaleY *= (e.scaleX+e.scaleY)/2;
    }
    
    function onRotate(e:TransformGestureEvent){
    	e.currentTarget.rotation += e.rotation;
    }
    
    function dragIt(e:MouseEvent){
    	e.currentTarget.startDrag();
    }
    
    function dropIt(e:MouseEvent){
    	e.currentTarget.stopDrag();
    }

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Have you tested the application on the actual device or only on the Simulator?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    I added:
    Code:
    import flash.ui.Multitouch;
    import flash.ui.MultitouchInputMode;
    import flash.events.TransformGestureEvent;
    And worked fine on my Android Bionic.
    [SIGPIC][/SIGPIC]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center