[Laszlo-dev] implementing non-rectangular masks in LZX

Max Carlson max at laszlosystems.com
Sat Jun 10 01:11:54 EDT 2006


Sarah Allen wrote:
> 
> I did a little looking into how this is done in Flash (swf7, scriptable 
> masks).  If you are intested, there's a nice tutorial here: 
> http://www.kirupa.com/developer/actionscript/scriptable_masks.htm .  The 
> cliff notes are:
>     myMovieClip.setMask(maskMovieClip)
> 
> After playing with it a bit, I think I want a mask to be another view, 
> so I can resize and position it.  Ideally something like:
>     <view resource="myimage_rsc" mask="anotherview"/>
> 
> I created a little test with the ActionScript inlined just to get the 
> hang of things.  This works fine:
> 
>     <view id="myview" resource="photo.jpg">
>         <method name="setMask" args="v">
>             Debug.write('setMask', v, v.__LZmovieClipRef);
>              this.__LZmovieClipRef.setMask(v.__LZmovieClipRef)
>         </method>
>     </view>
>     <view id="mymask" oninit="myview.setMask(this)" resource="star.swf"
>         x="130" y="-20" width="200" height="200" stretches="both"/>
> 
> 
> However, when I make the mask clickable (simply setting clickable="true" 
> will do it), the mask disappears when my mouse goes out of the mask's 
> bounds and reappears when the mouse goes back in.  I didn't see anything 
> magic in LzView's setClickable. 
> 
> Can anyone else give me a clue as to why this would happen?
> 
> Thanks,
> Sarah
> 
> p.s. I've been testing in lps-3.3.  As soon as I sync trunk, I'll check 
> into a test directory if anyone else wants to see it in action.


You should  be able to do this with a drawview by programatically 
drawing and calling the undocumented method clip() in place of where 
you'd normally do a fill().  It's untested territory, so it'd be great 
to get it worked on.  See the clip() method in 
http://svn.openlaszlo.org/openlaszlo/branches/legals/WEB-INF/lps/lfc/views/LzDrawView.as 
for more, and let me know how I can help!

-- 
Regards,
Max Carlson
OpenLaszlo.org


More information about the Laszlo-dev mailing list