Actually, I don't know if calling super.setAttribute is going to do the
right thing, maybe the mySetText method needs to call the super setter
explicitly?
     <text name="alerttext" x="${parent.text_x}" y="${parent.text_y}"
            resize="true" multiline="true">
            <attribute name="text" type="text" value="${parent.text}"
setter="this.mySetText(text)"/>
            <method name="mySetText" args="t">
                ....
                super.$lzc$set_text(t);
             </method>

On Tue, Jul 22, 2008 at 11:52 PM, Henry Minsky <[EMAIL PROTECTED]>
wrote:

>  I came across this code in the alert component
>         <text name="alerttext" x="${parent.text_x}" y="${parent.text_y}"
>             resize="true" text="${parent.text}" multiline="true">
>             <method name="setText" args="t">
>                 super.setText(t);
>                  ....
>
>
> which gets a swf9 error about an incompatible override, and in fact that's
> true, LzText.setText is defined as
> having a second optional arg
>
> LzText.setText is actually deprecated, and it has the method signature
>
>      function setText ( t, force = null){
>
> So what is the right way for user code to override the text setter on
> LzText? It seems like for
> one thing you should not need to know about the magic second arg. I don't
> think we want people
> to have to do
>
> <method name="$lzc$set_text" args="v">
> either..
>
>
> Is the approved way to ask them to declare the setter as an attribute?
>
> <text>
>    <attribute name="text" setter="..."
>
> So for alert code shown above, we need to move that text=${parent.text}
> constraint to the attribute declaration, and it becomes
>
>         <text name="alerttext" x="${parent.text_x}" y="${parent.text_y}"
>             resize="true" multiline="true">
>             <attribute name="text" type="text" value="${parent.text}"
> setter="this.mySetText(text)"/>
>             <method name="mySetText" args="t">
>                 ....
>                 super.setAttribute('text',t);
>              </method>
>
>
>
>
>
>
>
>
>
> --
> Henry Minsky
> Software Architect
> [EMAIL PROTECTED]
>
>


-- 
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to