Search code examples
flashcontextmenuopenlaszlolzx

Disabling the Flash Player default context menu in OpenLaszlo applications


When an OpenLaszlo application is deployed using the SWF10/11 runtime, is it possible to completely disable the Flash Player context menu on desktop computers?


Solution

  • That's only possible starting with Flash Player 11.2. I have done a test run with a modified version of OpenLaszlo based on the flex4.6 branch, adding Flash 11.2+ support to the OpenLaszlo compiler. With the following LZX code I managed to remove the default Flash Player context menu completely:

    <canvas width="100%" height="800" proxied="false">
    
        <passthrough when="$as3">
            import flash.events.MouseEvent;
        </passthrough>
    
        <handler name="oninit">
            if ($as3) {
                Debug.info(MouseEvent.RIGHT_CLICK);
                var sprite = this.getDisplayObject();
                sprite.addEventListener(MouseEvent.RIGHT_CLICK, doSomething);
            }
        </handler>
    
        <method name="doSomething" args="p">
            Debug.inspect(p);
        </method>
    
    </canvas>
    

    At the moment I'm not willing to contribute any more code to OpenLaszlo, due to the fact that Laszlo and Critical Path have been disrespecting the community in the past 2 years. I might create a private branch of OpenLaszlo where I'll add new features and bug fixes, and maybe this can be turned into a version maintained by the community.

    Therefore there is no way to use this example code with a released version or a nighly build of OpenLaszlo.