[Laszlo-dev] trouble at runtime with 'apply'
P T Withington
ptw at pobox.com
Tue Apr 22 03:55:09 PDT 2008
Maybe it is just time to bite the bullet and not support apply as both
a method and an attribute in state any more?
I think you can work around this by changing:
if (! (a in this))
to:
if (! this[a])
[Remember that `in` does not see "class fixtures", which the apply
method is.]
But, we really ought to make an API change. I would propose that the
state 'state variable' be named `applied`, not `apply`. That would be
consistent with the visibility/visible change we made for view.
On 2008-04-21, at 14:41 EDT, Henry Minsky wrote:
> I'm trying to get the slider component to work in swf9, and I have
> gotten to
> the point where I am
> getting this runtime error
>
> [Fault] exception, information=ReferenceError: Error #1037: Cannot
> assign to
> a method apply on .$lzc$class_state_$lz$2Fslider$2Elzx_9_52.
> Fault, __LZapplyArgs() at LzNode.as:273
> 273 this[a] = null
> (fdb) p a
> $1 = "apply"
> (fdb)
>
>
> I think this may be due to this line in the slider.lzx component
>
> <state apply="${this.classroot.showrange}">
> <text y="${classroot.track.y + classroot.track.height + 2}"
> text="${classroot.minvalue}" fgcolor="$
> {classroot.style ?
> classroot.style.textcolor : this.fgcolor}"
> />
> <text y="${this.classroot.track.y +
> this.classroot.track.height
> + 2}" resize="true"
> x="${classroot.track.x+classroot.track.width-width}"
> text="${classroot.maxvalue}" fgcolor="$
> {classroot.style ?
> classroot.style.textcolor : this.fgcolor}"
> />
> </state>
>
> The code in applyArgs is this line I think
>
> // NOTE: [2007-05-16 ptw] This check ensures that each
> // constrained attribute exists in the new instance.
> // Necessary because of 'implicit this', which will make a
> // free reference (error in Javascript) otherwise. We
> // have to not shadow inherited values because in some
> // cases (e.g., lz.state), we actually have a method and
> // an attribute of the same name! The attribute is
> // implemented by a setter, so it never clobbers the
> // method... er, unless you set the attribute to a
> // function. YOW!
> if (! (a in this)) {this[a] = null;}
>
>
> Is this something we can avoid in swf9?
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list