[Laszlo-dev] For Review: Change 20090613-raju-r Summary: Add support for Flash Player's ability to switch to full screen mode for SWFx

Raju Bitter rajubitter at me.com
Mon Jun 15 15:38:07 PDT 2009


Thanks, Max. That was quick, here are  a few answers:

> + Do you plan n adding a swf8 implementation?  You may want to set  
> the DHTML and swf8 fullscreen capability to false for now.  You  
> could check for the capability and then warn if it's not true in  
> LaszloCanvas.lzs#showFullScreen()

Yes, SWF8 implementation is planned. I'll do that once we have settled  
on the property names and where things should be placed. I'll place  
the warnings in LaszloCanvas.lzs#showFullScreen()

> + It seems like showFullScreen() really wants to be a setter so it  
> can be invoked by canvas.setAttribute('fullscreen', ...) - just  
> rename to $lzc$set_fullscreen().
> + Is the canvas.displaystate property actually required?  It seems  
> like the canvas.fullscreen attribute should provide enough  
> information.
We need 2 attributes on canvas. one to control addition of the  
embedding code (allowFullScreen=true), and another for making a method  
call to go into fullscreen display state. Those are 2 different  
things, we just need to choose the two names for them.

> + You could move the try/catch from  
> LZScreenKernel.as#showFullScreen() to the canvas method.  It would  
> catch all errors this way - even for swf8.
For SWF8 there's no error thrown, the Flash Player will just silently  
ignore the change in display state. That's why I introduced a  
displaystate attribute. Through that attribute it's possible to track  
if the attempt to go into fullscreen mode succeeded. The displaystate

> + It looks like you need a separate callback for  
> fullScreenEventHandler() because there's no guarantee the screen  
> state will change at the same time as showFullScreen() call.  I'd  
> suggest delegating the event sending to a callback method on the  
> canvas.  Also, it's probably not a good idea to leak the runtime- 
> specific FullScreenEvent property to the runtime through sendEvent()  
> - please coerce to a true/false value - the canvas.fullscreen  
> property also need to be set to this value.

Good points. I'll do that.

> + Your editor has inserted little bits of whitespace in various  
> places, making the diff a little hard to follow - not sure why!

Noticed that, I'm not sure what happened. Will take care of that with  
the next version.

Thanks a lot, will send a new version out tomorrow.

- Raju :-)

>
> Raju Bitter wrote:
>> Sarah, Max,
>> here's how you can test the updated version:
>> Compile test/fullscreen/fullscreentest1.lzx?lzr=swf9
>> There's a new attribute on canvas: @fullscreen
>> @fullscreen is set to "true", that means you can switch to  
>> fullscreen mode by calling canvas.showFullScreen(true). That method  
>> call has to be triggered either by a keypress or mouse click to  
>> work (Flash security!).
>> If you set fullscreen="false" and compile, clicking on the "Toggle  
>> Fullscreen" button will give you an error message in the debug  
>> window. I've changed the template for lzt=html as well, so app- 
>> console.xslt and html-reponse.xslt are the only ones that work for  
>> now.
>> What do you think of this approach? Feedback welcome!
>> - Raju
>> Change 20090613-raju-r by raju at Atlantia on 2009-06-13 23:52:31 CEST
>>    in /Users/rajubitter/src/svn/openlaszlo/trunk
>>    for http://rajubitter@svn.openlaszlo.org/openlaszlo/trunk
>> Summary: Add support for Flash Player's ability to switch to full  
>> screen mode for SWFx
>> New Features:
>> Bugs Fixed: LPP-8107
>> Technical Reviewer: max
>> QA Reviewer: (pending)
>> Doc Reviewer: (pending)
>> Documentation:
>> The documentation has to be updated, to reflect the new  
>> functionality.
>> Release Notes:
>> Works with Flash Player version 9.0.28. and all later versions.
>> Details:
>> http://jira.openlaszlo.org/jira/browse/LPP-8107
>> Embedding code
>>  lps/includes/sources/embednew.js
>>    + method lz.embed.swf
>>       - added allowFullScreen: properties.fullscreen
>>  lps/includes/sources/flash.js
>>    + method lz.embed.dojo
>>      + added value to defaults: fullscreen: true
>>    + lz.embed.dojo.Embed.prototype.write
>>      object.html: added param/attribute allowFullScreen
>> LFC changes for all runtimes
>>  WEB-INF/lps/lfc/views/LaszloCanvas.lzs
>>    + @initarg documentation added for fullscreen
>>    + public var fullscreen added
>>    + onfullscreen event added
>>    + public var diplaystate added
>>    + handling of @initarg fullscreen added to construct() method
>>    + Warning for runtimes that don't support fullscreen (DHTML)  
>> added to construct method
>>    + method function showFullScreen(fullscreen=true) added
>> SWF9 specific changes
>>  WEB-INF/lps/lfc/kernel/swf9/LzScreenKernel.as
>>    + Added method showFullScreen
>>    + Added handler for FullScreenEvent fullScreenEventHandler
>>  WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
>>    + added fullscreen: true to capabilities
>> Compiler (Java classes)
>>  WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java
>>    + private static final boolean DEFAULT_FULLSCREEN = false;
>>    +  /** Fullscreen setting for canvas */
>>       private boolean mFullscreen = false;
>>    + methods setFullscreen() and isFullscreen()
>>    + in method public String getXML(String content) {
>>      - added "fullscreen='" + isFullscreen() + "' " + to buffer
>>  WEB-INF/lps/server/src/org/openlaszlo/compiler/Canvas.java
>>    + in method public void initializeFromElement(Canvas canvas,  
>> Element elt)
>>        if (fullscreen != null) {
>>            canvas.setFullscreen(fullscreen.equals("true"));
>>        }
>> XSLT template files
>>  WEB-INF/lps/templates/html-response.xslt
>>  WEB-INF/lps/templates/app-console.xslt
>>    + added allowFullScreen: '<xsl:value-of select="/canvas/ 
>> @fullscreen"/>' to lz.embed.dhtml({})
>> Tests:
>> test/fullscreen/fullscreen1.lzx
>> Simple test file for to go into fullscreen mode by clicking a button.
>> Files:
>> A       test/fullscreen
>> A       test/fullscreen/fullscreentest1.lzx
>> M       WEB-INF/lps/lfc/kernel/swf9/LzScreenKernel.as
>> M       WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
>> M       WEB-INF/lps/lfc/views/LaszloCanvas.lzs
>> M       WEB-INF/lps/server/src/org/openlaszlo/compiler/ 
>> CanvasCompiler.java
>> M       WEB-INF/lps/server/src/org/openlaszlo/compiler/Canvas.java
>> M       WEB-INF/lps/templates/html-response.xslt
>> M       WEB-INF/lps/templates/app-console.xslt
>> M       lps/includes/source/embednew.js
>> M       lps/includes/source/flash.js
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090613-raju-r.tar
>
> -- 
> Regards,
> Max Carlson
> OpenLaszlo.org



More information about the Laszlo-dev mailing list