[Laszlo-dev] method in state confused about scope ?
Henry Minsky
henry.minsky at gmail.com
Wed Apr 2 15:16:45 PDT 2008
I got this error when compiling a test app that uses <dragstate>
<view id="foo" bgcolor="0xcccccc"
x="100" y="100"
height="200" width="200"
onmousedown="dragger.apply()"
onmouseup="dragger.remove()">
<dragstate name="dragger"/>
</view>
Compiler error: at 38 [/tmp/lzswf9/lzgen22136/$lzc$class_dragstate.as:
18]: Error: Call to a possibly undefined method __dragstate_getnewpos.
this.setAttribute("x", this.drag_axis == "both" || this.drag_axis ==
"x" ? __dragstate_getnewpos("x", this.immediateparent.getMouse("x") +
this.__dragstate_xdoffset) : this.x)
^
Compiler error: at 29 [/tmp/lzswf9/lzgen22136/$lzc$class_dragstate.as:
22]: Error: Call to a possibly undefined method __dragstate_getnewpos.
this.setAttribute("y", this.drag_axis == "both" || this.drag_axis ==
"y" ? __dragstate_getnewpos("y", this.immediateparent.getMouse("y") +
this.__dragstate_ydoffset) : this.y)
^
In lps/components/utils/states/dragstate.lzx, the definition of the x
and y attribute constraints looks like this
<attribute name="x"
value="(this.drag_axis == 'both' || this.drag_axis == 'x') ?
__dragstate_getnewpos('x',
this.immediateparent.getMouse( 'x' ) +
this.__dragstate_xdoffset)
: this.x"
when="always"/>
If I change that function call to have "this.",
"this.__dragstate_getnewpos", then it compiles without complaining.
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list