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

P T Withington ptw at openlaszlo.org
Sat Jun 10 08:57:38 EDT 2006


Is Sarah's suggestion for an LZX syntax, a tag parameter `mask`,  
referring to another view), the way we want to specify this?  Whether  
the mask view is specified by a resource or drawn would then be  
independent, no?  And how does this map down to the Sprite API?

Let's have a proposal http://wiki.openlaszlo.org/Enhancement_Proposals.

On 2006-06-10, at 01:11 EDT, Max Carlson wrote:

> 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
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev



More information about the Laszlo-dev mailing list