I am developing a Flash CS5 iOS app. On one of the frames I am drawing a good many rectangles in a particular pattern. I would like to use two-finger zoom and gestures to zoom into these rectangles on the frame but keep the general pattern of these rectangles the same. Also once zoomed in, the user will need开发者_C百科 to pan around the enlarged graphics.
I know I could create an event handler that when I zoom in it adds width and height to each of the rectangles but then I have to worry about increasing the X and Y positions of each of the rectangles so I keep the same distance between each one and so forth.
I there an easier way to do this?
Thanks
If you're drawing the rectangles as vectors, you should be able to use the scale the property I think, otherwise you might need to redraw the bitmap rectangles based on the new scale.
To use the Zoom Gesture you must first set the inputMode to touch:
Multitouch.inputMode = MultitouchInputMode.GESTURE;
and you'll need to listen to TransformGestureEvent.ZOOM and use the event's scaleX,scaleY:
yourRectangles.addEventListener(TransformGestureEvent.ZOOM,onZoom);
function onZoom(event:TransformGestureEvent):void{
trace(event.scaleX,event.scaleY);
}
HTH
精彩评论