[Laszlo-dev] For Review: Change 20080607-maxcarlson-3 Summary: Fix duplicate onresource event sending

André Bargull a.bargull at intensis.de
Sun Jun 8 05:41:02 PDT 2008


Changes for LzView are ok,
for LzSprite.js, you need to set the "resource"-field if the method was 
called by a user (so if "LzView#setSource(..)" was called), because 
we're invoking "this.owner.resourceload(..)" with the content of that field:
> LzSprite.prototype.setSource = function (url, usecache){
>     if (usecache != true){
>         // called by a user
>         this.skiponload = false;
>         *this.resource = url;*
>     }

LzSprite.as still has some issues:
If you load a normal resource everything is ok: only one 
onresource-event is fired and the resource-field is set to the proper 
value (LPP-6134), but if you're calling "LzView#setSource(..)", there is 
an additional "onresource"-event for the "empty-resource".
A possible stacktrace looks like this:
LzSprite#setSource() -> LzMakeLoadSprite.transform() -> 
LzSprite#makeContainerResource() -> *LzSprite#setResource("empty")* -> ...
So we need to intercept the "onresource"-event for the "empty-resource".

Btw, I've figured this out with the testcase from LPP-6135.

Argh, this is so complicated! :-)


On 6/8/2008 7:35 AM, Max Carlson wrote:
> Change 20080607-maxcarlson-3 by maxcarlson at Roboto on 2008-06-07 
> 22:06:40 PDT
>     in /Users/maxcarlson/openlaszlo/trunk-clean
>     for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: Fix duplicate onresource event sending
>
> Bugs Fixed: LPP-6134 - wrong resource-name, LPP-5795 - DHTML: resource 
> is not source!
>
> Technical Reviewer: a.bargull at intensis.de
> QA Reviewer: promanik
> Doc Reviewer: (pending)
>
> Details: LzSprite.as - Set resource property early to ensure 
> resourceload events are sent properly.
>
> LzSprite.js - Set the resource property to the correct value.  Use a 
> separate source attribute to track the url to be flushed from the 
> image cache.
>
> LaszloView.lzs - Remove vestigial __LZhaser property.  Always call 
> sprite.setResource(), and rely on resourceload() callbacks to send 
> onresource events.
>
> Tests: See testcases for LPP-6134 and LPP-4975 in swf and dhtml.  
> demos/lzpix/app.lzx runs as before in swf and dhtml.
>
> Files:
> M      WEB-INF/lps/lfc/kernel/swf/LzSprite.as
> M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
> M      WEB-INF/lps/lfc/views/LaszloView.lzs
>
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/20080607-maxcarlson-3.tar
>


More information about the Laszlo-dev mailing list