[Laszlo-dev] For Review: Change 20090302-hqm-y Summary: catch and forward mouse clicks from TextField

André Bargull andre.bargull at udo.edu
Tue Mar 3 09:16:56 PST 2009


I got a stack-overflow which crashed the Player/Browser when I used your 
change (I clicked somewhere on the debugger).
And I think the "__forwardMouseEventToSprite" function needs to be 
adjusted, because:
- it's possible that other non-mouseEnabled sprites are on top of the 
TextField in which case length-2 won't work
- the event needs to be forwarded to the next mouseEnabled sprite

And the handcursor is not shown in the second testcase at LPP-7551 when 
you move the mouse over the text. (I don't know how to fix that, though.)

Here's an updated version:

function __forwardMouseEventToSprite(e:MouseEvent):void {
     var tfound:Boolean = false;
     var objs:Array = LFCApplication.stage.getObjectsUnderPoint(new 
Point(e.stageX, e.stageY));
     for (var i:int = objs.length - 1; i >= 0; --i) {
         var obj:DisplayObject = objs[i];
         if (! tfound) {
             tfound = (obj === this.textfield);
         } else if (obj is InteractiveObject) {
             var iobj:InteractiveObject = InteractiveObject(obj);
             if (iobj.mouseEnabled) {
                 iobj.dispatchEvent(e);
                 break;
             }
         }
     }
}

On 3/3/2009 3:59 AM, Henry Minsky wrote:
> 
> This isn't really a fix for this bug, but more an experiment to see if 
> we can make swf9 emulate the behavior of clicking
> on text links in swf8.
> 
> Change 20090302-hqm-y by hqm at badtzmaru.home on 2009-03-02 21:49:53 EST
>     in /Users/hqm/openlaszlo/trunk3
>     for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: catch and forward mouse clicks from TextField
> 
> New Features:
> 
> Bugs Fixed: LPP-7551
> 
> Technical Reviewer: andre, max
> QA Reviewer: (pending)
> Doc Reviewer: (pending)
> 
> Documentation:
> 
> Release Notes:
> 
> Details:
> 
> + this is a test of the idea of catching all mouse events on a 
> TextField, and
> dispatching them to the next view behind
> 
> mouseEnabled is always set to true for the TextField in LzTextSprite, 
> and all mouse
> events are caught and forwarded back to the view behind the text field.
> 
> 
> 
> 
> Tests:
> 
> + second test case from LPP-7551, behaves more like swf8
> 
> <canvas debug="true">
>   <view width="200" height="100%" bgcolor="#aaaaff">
>     <handler name="onclick" >
>       var newbg = (this.bgcolor == 0xaaaaff ? 0xaaffaa : 0xaaaaff);
>       this.setAttribute("bgcolor", newbg);
>     </handler>
>   </view>
>   <text multiline="true" width="150">
>     <handler name="oninit" ><![CDATA[
>       this.format("click <u>%s</u> or <u>%s</u>", 
> this.makeTextLink("here", "opt1"),
>  this.makeTextLink("here", "opt2"));
>     ]]></handler>
>     <handler name="ontextlink" args="val" >
>       this.addFormat("\noption %d was clicked", val == "opt1" ? 1 : 2);
>     </handler>
>   </text>
> </canvas>
> 
> 
> Files:
> M      WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
> M      WEB-INF/lps/lfc/views/LzText.lzs
> 
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090302-hqm-y.tar
> 


More information about the Laszlo-dev mailing list