1 msgMOUSE_DOWN & CLICK are not firing on the fi...
2 msgstill the 'click to activate this ActiveX'.
1 msgcan't login to switch back to digest?

Collision detection NOT using hitTest()
\ Jeff Fox (23 Feb 2007)
. \ T. Michael Keesey (23 Feb 2007)

1 msgWhich components are used at spiegel.de?
1 msgflash games network
5 msgFlash chat and Smiley
1 msgFwd: use of Flash IDE (or: workflow)
1 msgRearrange Fields between DataSet and DataGrid
1 msgAS2 Developers wanted - Ipswich UK
1 msgSmall text in components
1 msgis it still broken?
1 msgBROKEN ...
1 msgScreensaver creator?
1 msgFW: Are keyboard shortcuts possible for MenuBar...
24 msgTEST
1 msg<no subject>
3 msgList down, now back up
5 msgFLV issue within IE7?
2 msgFlash sniffer,version detector and swfObject al...
Subject:Re: Collision detection NOT using hitTest()
Group:Flashcoders
From:T. Michael Keesey
Date:23 Feb 2007


 
Look into flash.geom.Rectangle, specifically the intersects(Rectangle) method.

On 2/23/07, Jeff Fox <jfox015> wrote:
> Hey gang,
> I have a map movie that needs to test whether two near objects will overlap
> one another BEFORE I actually instantiate and draw the movie clip, so I need
> a good object collision test that does not use hitTest(). I have a set of x
> and y and size properties for each object that I use to place them when
> they're created, but what I want to do is if the objects will overlap at any
> point, merge them into a single object.
>
> Here's an example of what I need to catch:
>
> Point A Los Angeles (x: 150, y: 99, size: 8 pixels)
> Point B: San Diego (x: 153, y: 103, size: 8 pixels)
>
> When drawn, the LA dot and San Diego dot will overlap a little and therefore
> cause a problem rendering pop-up content, so I want to merge them. What I
> need is a reliable check to see if that happens. Right now I'm using:
>
> var uLeftX:Number = cityA._x - 2;
> var lRightX:Number = (cityA._x + _size) +2;
> var uLefttY:Number = cityA._y - 2;
> var lRightY:Number = (cityA._y + _size) +2;
>
> if (mapObjects.length > 1) {
> for (var mo:Number = 0; mo < mapObjects.length; mo++) {
> // GET VISIBLE AREA OF CURRENT MAP OBJECT
> var tmpULeftX:Number = parseInt(mapObjects[mo]._x) - 2;
> var tmplRightX:Number = (parseInt(mapObjects[mo]._x) + _dotSize) +2;
>
> var tmpuLeftY:Number = parseInt(mapObjects[mo]._y) - 2;
> var tmplRightY:Number = (parseInt(mapObjects[mo]._y) + _dotSize) +2;
> if ((uLeftX > tmpULeftX && uLeftX < tmplRightX) && (uLefttY >
> tmpuLeftY && uLefttY < tmplRightY)) {
> trace("Dot collision occures between " + cityA.cityName + " and
> " + mapObjects[mo].cityName);
> }
> } // END for
> } // END if
>
> The above script DOES detect collisions, but not between the LA and San
> Deigo properties listed above. Can anyone see a flaw in the line that tests
> the overlap?
>
> -Jeff
> --
> Jeff Fox
> jfox015
>
> --
> Jeff Fox
> jfox015
> _______________________________________________
> Flashcoders
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


--
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry & Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
_______________________________________________
Flashcoders
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


© 2004-2008 readlist.com