[Laszlo-dev] containsPt and clickRegion
jstafford at inspiration.com
Wed Mar 8 12:55:45 EST 2006
Thanks to everyone for their suggestions, especially Chris Kohlhardt.
No one gave me the exact answer I was looking for, but eventually I
figured it out.
Here is my new function for checking if a point is within a click region:
<method name='preciseContainsPt' args='inX,inY'>
Personally I think this is how containsPt should be implemented, and
I'll file a bug making that suggestion.
If you use this function, please note that unlike containsPt, which
takes an x and y relative to itself, preciseContainsPt takes an x,y
relative to the canvas.
Chris Kohlhardt wrote:
>> 2) In the meantime does anyone know a way to test a point against the
>> clickRegion? I'm guessing that this would likely involve getting the
>> MovieClipRef and using some Flash APIs to do it, but I don't know
>> anything about how to actually code this.
> When I worked at Laszlo I built this:
> There are a few ways to pull off what you're looking to do:
> 1) Create a .swf asset for each thing that has a click region. Use
> the Flash click region testing to determine if your asset will be
> clicked and call a method in Laszlo identifying what was clicked.
> 2) Create an array which is a lookup table containing the possible
> hit areas. Constantly check the mouse position to see if it's over a
> hit area by looking in the array. (This is how the lqmap was
> In Gliffy we wrote something far more complex and robust to solve
> this. We have an efficient two level collision detector which first
> looks up which objects are 'near' the clicked point, and then calls a
> custom isClicked() method on each object found for detailed collision
> checking. A similar mechanism makes it possible for us to do fancy
> stuff like route orthogonal lines around shapes already on the stage.
> Chris Kohlhardt
> chrisk at gliffy.com
> c: 415-505-6429
> f: 415-651-9625
Inspiration Software, Inc.
The leader in visual thinking & learning
Introducing INSPIRATION(r) 8, the essential tool to visualize, think,
organize and learn. Students use Inspiration to plan, research and
complete projects successfully. Learn more at www.inspiration.com.
503-297-3004 Extension 119
9400 SW Beaverton-Hillsdale Highway
Beaverton, OR 97005-3300
More information about the Laszlo-dev