Unfortunately, it doesn't look like you can accomplish what you want with hitTestObject
. I played around with setting the clipContent
and horizontalScrollPolicy
properties on your canvases, to no use. What I think is happening is that hitTestObject
considers your canvas to be as wide as the longest child component, regardless of any clip masks or scroll bars.
Are you forced to use hitTestObject
? If not, I'd suggest writing your own collision detection function along the lines of:
public static function componentsCollide( obj1:DisplayObject, obj2:DisplayObject ):Boolean {
var bounds1:Rectangle = new Rectangle( obj1.x, obj1.y, obj1.width, obj1.height );
var bounds2:Rectangle = new Rectangle( obj2.x, obj2.y, obj2.width, obj2.height );
return bounds1.intersects( bounds2 );
}
Dan
2009-08-14 15:05:46