Flint Particle System Forum - DisplayObjectZone Bug & Patch 2016-06-03T05:59:33+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher DisplayObjectZone Bug & Patch http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=965#Comment_965 2009-11-10T01:18:48+00:00 2009-11-10T01:25:40+00:00 mcav http://flintparticles.org/forum/account.php?u=264 My SWF's root (document class movieclip) is scaled so that I can have some objects resize to the stage and some not. DisplayObjectZone presently doesn't calculate proper bounds in that case. ...
DisplayObjectZone presently doesn't calculate proper bounds in that case. I've changed a couple lines in DisplayObjectZone.as which fix the problem. In essence, I use getBounds from the "root" display object ,and then convert those coordinates to renderer coordinates. (Your code used the stage to do that, but didn't work with scaling properly).


/**
* The getLocation method returns a random point inside the zone.
*
* @return a random point inside the zone.
*/
public function getLocation() : Point
{
var bounds:Rectangle = _displayObject.getBounds( _displayObject.root );
do
{
var x : Number = bounds.left + Math.random( ) * bounds.width;
var y : Number = bounds.top + Math.random( ) * bounds.height;
}
while( !_displayObject.hitTestPoint( x, y, true ) );
var point:Point = new Point( x, y );
point = _renderer.globalToLocal( displayObject.root.localToGlobal( point ) );
return point;
}



I should add that without this patch, it gets stuck in the while() loop because hitTestPoint never returns true.]]>
DisplayObjectZone Bug & Patch http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=969#Comment_969 2009-11-12T08:03:10+00:00 2016-06-03T05:59:33+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Thank you for finding and fixing the bug. I'll check your patch at the weekend and commit it to SVN. Unfortunately, you just missed the 2.1.3 update so it'll be in 2.1.4 when I release ...
I'll check your patch at the weekend and commit it to SVN. Unfortunately, you just missed the 2.1.3 update so it'll be in 2.1.4 when I release that.

Richard]]>
DisplayObjectZone Bug & Patch http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=1026#Comment_1026 2009-12-29T03:33:30+00:00 2016-06-03T05:59:33+01:00 mcav http://flintparticles.org/forum/account.php?u=264 No problem. Let me know if you need more explanation or another test case. DisplayObjectZone Bug & Patch http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=1139#Comment_1139 2010-03-09T05:34:44+00:00 2016-06-03T05:59:33+01:00 mcav http://flintparticles.org/forum/account.php?u=264 [bump]