Flint Particle System Forum - DisplayObjectZone Bug & Patch Fri, 03 Jun 2016 05:51:58 +0100 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher DisplayObjectZone Bug & Patch http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=965#Comment_965 http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=965#Comment_965 Tue, 10 Nov 2009 01:18:48 +0000 mcav
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 http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=969#Comment_969 Thu, 12 Nov 2009 08:03:10 +0000 Richard
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 http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=1026#Comment_1026 Tue, 29 Dec 2009 03:33:30 +0000 mcav DisplayObjectZone Bug & Patch http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=1139#Comment_1139 http://flintparticles.org/forum/comments.php?DiscussionID=270&Focus=1139#Comment_1139 Tue, 09 Mar 2010 05:34:44 +0000 mcav