OpenLaszlo kills some mouse events of a loaded Fle

2019-05-23 16:30发布

问题:

This is a question about OpenLaszlo (or rather Flex?) internals:

I was able to load a full Flex application swf into a OpenLaszlo (trunk release, older releases failed). It works in Flash 10 as well as in 11. But OpenLaszlo seems to capture or block certain mouse events. When I add the SWF into

YFilesSWF.content.sprite (YFilesSWF is extending the window class)

then most mouse actions work (e.g. Flex buttons), but some don't (some clickable items on a kindo f canvas). I observed further that when I add the SWF to

YFilesSWF.sprite (YFilesSWF is extending the view)

, then the SWF does not react to ANY mouse events anymore. That means window is somewhat better, but not good enough. I'm using the

flash.display.Loader

class for loading the SWF in a normal way. This is the AS3 Loader class implementation which I use for loading the swf and which I include inside the OpenLaszlo app :

 public class LoadSwf extends Sprite
 {
      public var externalSwfLoader:Loader = new Loader();
      public var swfDisplayObject:DisplayObject;
      public var swfComObject:Object;

     public function LoadSwf(url:String,p:Sprite):void
     {
//                externalSwfLoader.mouseChildren = false;
//                this.mouseChildren = false;
//                p.mouseChildren = false;   

//                externalSwfLoader.mouseEnabled = false;
//                this.mouseEnabled = false;
//                p.mouseEnabled = false;   

            p.addChild(this);
          externalSwfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, createSwfObjects);
          externalSwfLoader.load(new URLRequest(url));
     }

     public function createSwfObjects(evt:Event):void
     {
          var loaderInfo:LoaderInfo = evt.target as LoaderInfo;

          swfDisplayObject = evt.target.content;
          swfComObject = loaderInfo.content;

          addChild(swfDisplayObject);
     }
}

This is the OpenLaszlo code of how the class is used:

<class name="YFilesSWF" extends="window">

            <passthrough>
                    import LoadSwf;
            </passthrough>

            <attribute name="loadSwf" />

            <handler name="oninit"><![CDATA[
                    this.loadSwf = new LoadSwf("SimpleGraphEditor.swf", this.content.sprite);
            ]]></handler>
 </class>

Does anybody know what and where OpenLaszlo is destroying some of the Flex mouse events and how to prevent it? Is there a yet better component than window that will preserve the Flex mouse events? What would be required to modify in the OL components source code?

Thanks!