View Full Version : Select object, not container
shmk
April 14th, 2008, 05:34 AM
I load a non-square image with transparency in a Bitmap->BitmapData and then add this in a MovieClip to allow the use of drag/drop.
But the MOUSE_DOWN select the "square" that contain the image.
I want that the drag starts when with the mouse you click on the image, not on the square that wrap the image.
shmk
April 16th, 2008, 01:41 PM
I've tried with a:
if(obj.getChildAt(0).bitmapData.getPixel32(event.l ocalX,event.localY)>0)
obj.startDrag();
}
and the Drag starts only if the clicked pixel isn't transparent.
But this doesn't resolve my problem, because if 2 movieclips are one over the other I want that if I click on the transparent background of the top one (that allow to view the object under), the one under get the focus and start the drag.
Groady
April 17th, 2008, 02:56 AM
First of all you should should probably be using the hitTest() (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html#hitTest()) method on your BitmapData object rather than getPixel32.
Second, you will need to use getObjectsUnderPoint() (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObjectContainer.html#getObjectsUnderPoint() ). If hitTest determines that you've clicked on a transparent part of an image you'll need to trigger the object below the currently clicked one. At least in theory that's what should happen. I've never done this myself but that's where I would start.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.