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'>
    <![CDATA[
           return this.__LZmovieClipRef.hitTest(inX,inY,true);
    ]]>
    </method>

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.

-Jason



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:
>
> http://www.lq.com/lq/map/index.jsp
>
> 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 
> implemented)
>
> 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.
>
> -chrisk
>
>
> Chris Kohlhardt
> [EMAIL PROTECTED]
> c: 415-505-6429
> f: 415-651-9625
>
>

-- 
Jason Stafford
Principal Developer
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
503-297-4676 (Fax)
9400 SW Beaverton-Hillsdale Highway
Suite 300
Beaverton, OR 97005-3300

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to