[Laszlo-dev] code for component "style" class probably will not work in swf9

Henry Minsky hminsky at laszlosystems.com
Wed Jul 16 08:09:10 PDT 2008


Would this code be equivalent?

    <method name="extend" args="args">
        var temp = new lz.style();
        for (var p in args) {
            temp[p] = args[p];
        }
        new LzDelegate(temp, '_forwardstylechanged', this, 'onstylechanged');
        return temp;
    </method>

If I do that, the example runs without error in swf9


On Wed, Jul 16, 2008 at 11:06 AM, Henry Minsky
<hminsky at laszlosystems.com> wrote:
> TypeError: Error #1034: Type Coercion failed: cannot convert
> Object at 1735eb79 to .LzEventable.
>        at $lzc$class_style/extend()[/Users/hqm/openlaszlo/lib/jakarta-tomcat-5.0.30/temp/lzswf9/lzgen26457/$lzc$class_style.as:88]
>        at $lzc$class_basecomponent/setStyle()[/Users/hqm/openlaszlo/lib/jakarta-tomcat-5.0.30/temp/lzswf9/lzgen26457/$lzc$class_basecomponent.as:99]
>        at $lzc$class_basecomponent/$lzc$set_style()[/Users/hqm/openlaszlo/lib/jakarta-tomcat-5.0.30/temp/lzswf9/lzgen26457/$lzc$class_basecomponent.as:86]
>        at LzEventable/setAttribute()[/private/tmp/lzswf9/lzgen38234/LzEventable.as:23]
>        at $lzc$class_button_left1/$lzc$bind_style$left1_$m234()[/Users/hqm/openlaszlo/lib/jakarta-tomcat-5.0.30/temp/lzswf9/lzgen26457/$lzc$class_button_left1.as:4]
>
>
> The code in question is in the extend() method on the class 'style'
>
>    <!--- returns a new lz.style object which is based on this one
>        with only specified attributes modified
>        <br/>param dictionary args: the attributes for the new lz.style
>    -->
>    <method name="extend" args="args">
>        var temp = {};
>        for (var p in args) {
>            temp[p] = args[p];
>        }
>        temp.__proto__ = this;
>
>        new LzDelegate(temp, '_forwardstylechanged', this, 'onstylechanged');
>        return temp;
>    </method>
>
>
> So, what's this trying to accomplish? Can we instantiate a proper
> style object? Was this trying to save
> the cost of a real class instance instantiation time?
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>



-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com


More information about the Laszlo-dev mailing list