Grig filed a bug here and I already responded, he's just missing the 'new' operator:
http://jira.openlaszlo.org/jira/browse/LPP-9472 > makeChild is a private API and has changed. But you are right, we recommend > that you simply instantiate your view directly, rather than calling makeChild > (that's really all it does anyways). It's just that you are forgetting the > 'new' call. Try: > > var newview = new lz.aclass(canvas); > > It sucks that Javascript lets you call a constructor without new. For some > built-in classes this has special meaning, but for most classes it is really > just a programmer error. On 2010-10-22, at 08:29, Henry Minsky wrote: > If I use the "new" operator, it works properly for me, the red square is > instantiated in all runtimes. > > > <canvas debug="true"> > > <class name="aclass" bgcolor="red" width="100" height="100"> > > </class> > > <handler name="oninit"><![CDATA[ > var newview = new lz.aclass(canvas,{x:10,y:10}); > ]]></handler> > > </canvas> > > > On Thu, Oct 21, 2010 at 5:35 PM, Max Carlson <[email protected]> wrote: > >> Can you take a look? >> >> >> >> Begin forwarded message: >> >> *From:* Grig <[email protected]> >> *Date:* October 21, 2010 1:09:37 PM MDT >> *To:* Max Carlson <[email protected]> >> *Subject:* *the new newing* >> >> I was trying to get things rolling in the latest build. I need this to >> work, but it doesn't: >> >> >> var newview = lz[className](viewToBuildIn, tempArray); >> >> >> className is passed to the function. I haven't found a way to new a view >> where the name isn't hard coded as in: lz.myclass(viewToBuildIn, tempArray); >> >> >> In this test case, the newview is never made. So I'm not sure what I'm >> missing with the new code. >> >> <canvas debug="true"> >> >> <class name="aclass" bgcolor="red" width="100" height="100"> >> >> </class> >> >> <handler name="oninit"><![CDATA[ >> >> // lpsbuild: tr...@17706 (17709) >> >> >> var aview = canvas.makeChild({ name: "aclass" }); >> >> // after the line above, debug reports: ERROR: Attempt to >> instantiate <aclass>, which has not been defined >> >> >> >> var newview = lz.aclass(canvas,{x:10,y:10}); >> >> // after the line above, nothing happens >> >> ]]></handler> >> >> </canvas> >> >> >> I hope you made it safely down the mountain! >> >> Cheers! >> >> G >> >> >> > > > -- > Henry Minsky > Software Architect > [email protected]
