I have two display object I want to check overlapping on - one of the
object will be very odd shaped, so I need to take advantage of the
ShapeFlag of the hitTestPoint method to be sure the object's shape is
taken into account.  The problem is, each display object is nested
inside other many display objects - and each is nested in a different
display list hierarchy.  So global coordinates and local coordinates
have to be accounted for otherwise, the hittesting is all messed up
-meaning, the wrong objects are detected to be overlapping.

 

The hitTestObject () method won't work because even though it compares
the two objects, it doesn't have shapeFlag, which I need for at least
one of the objects, which is an odd-shaped user-drawn polygon.
HitTestPoint() works for the odd shape, but it only compares a point to
an object - which is normally OK, but if I convert one of the objects
down to global coordinates, the other is still using it's own local
coordinates, so the wrong objects are detected to be overlapping.  

 

Colin Holgate on Flash_Tiger, when I asked earlier about a similar
hittest problem, posted a link to this class:
http://www.adventuresinactionscript.com/blog/15-03-2008/actionscript-3-h
ittestobject-and-pixel-perfect-collision-detection  but so far, it
doesn't seem to be working with detecting collision between these two
objects, I assume because of the same problem I am facing: they are in
different display hierarchies and thus their discrepancies in local
coordinates are messing up the detection.

 

Any thoughts?

Jason Merrill
Bank of America 
Enterprise Technology & Global Risk L&LD
Instructional Technology & Media 

Join the Bank of America Flash Platform Developer Community
<blocked::http://sharepoint.bankofamerica.com/sites/tlc/flash/default.as
px>  

Are you a Bank of America associate interested in innovative learning
ideas and technologies?
Check out our internal  Innovative Learning Blog
<blocked::http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/default.
aspx>  & subscribe
<blocked::http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/_layouts
/SubNew.aspx?List=\%7b41BD3FC9-BB07-4763-B3AB-A6C7C99C5B8D\%7d&Source=ht
tp://sharepoint.bankofamerica.com/sites/ddc/rd/blog/Lists/Posts/Archive.
aspx> . 

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to