I've got a little test LZX code that has a click handler like this:

<view id="bar" x="200" y="200" >
    <view id="foo" bgcolor="0xcccccc" x="-100" y="-100"  height="200"
width="200"
          onclick="parent.animate('rotation', 360, 1500, true)"
          >

When I compile it I get this error from the  flex compiler

/cygdrive/c/flex2/bin/mxmlc -debug=true
-library-path+=../../../lps/includes/lfc/LFC9.lzl  -default-size 800 600
-default-frame-rate 60 DemoApp.as
Loading configuration file C:\flex2\frameworks\flex-config.xml
C:\users\hqm\openlaszlo\devildog\WEB-INF\lps\lfc\DemoApp.as(49): col: 20
Error: Call to a possibly undefined method animate through a reference with
static type flash.display:DisplayObjectContainer.

            parent.animate('rotation', 360, 1500, true)
                   ^

 The handler is compiled to a function inside of the usual stuff passed to a
call to LzInstiateView:


LzInstantiateView({attrs: {id: "bar",
                           x: 200,
                           y: 200},
                   children: [{attrs:
                               {$delegates: ["onclick", "$m1", null,
"oninit", "$m2_foo_reference", null],
                                $m1: function foo_$m1() {
                        parent.animate('rotation', 360, 1500, true)
                    }, ...


 So I am not sure in what context the compiler thinks that "parent" is being
looked up.


 If I change the code to refer to "this.parent", it compiles happily, and
appears to work

   <view id="bar" x="200" y="200" >
    <view id="foo" bgcolor="0xcccccc" x="-100" y="-100"  height="200"
width="200"
          onclick="this.parent.animate('rotation', 360, 1500, true)"
          >



-- 
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to