[Laszlo-dev] "Instantiation attempted on a non-constructor" when creating a layout programmatically?
P T Withington
ptw at pobox.com
Fri Mar 23 04:43:50 PDT 2012
One thing to try is to write your code using a static layout and look at the code the compiler generates as a model for what you will need to do.
On 2012-03-19, at 17:21, augusto callejas wrote:
> when i run the sample code below (openlaszlo 4.9.0, swf10, flex debugging on):
> ===
> <canvas width="100%" height="100%">
> <view>
> <handler name="oninit">
> this.setAttribute("layout", new lz.simplelayout(this, {axis: "x", spacing: 10}));
> </handler>
> <text>one</text>
> <text>two</text>
> </view>
> </canvas>
> ===
>
> i get the following error in the adobe flash player debugger window:
> ===
> TypeError: Error #1007: Instantiation attempted on a non-constructor.
> at $lzc$class_m2/$m1()
> at Function/http://adobe.com/AS3/2006/builtin::call()
> at LzEvent/sendEvent()
> at LzNode/__LZcallInit()
> at LzCanvas/__LZcallInit()
> at LzCanvas/__LZinstantiationDone()
> at LzInstantiatorService/makeSomeViews()
> at LzInstantiatorService/checkQ()
> at Function/http://adobe.com/AS3/2006/builtin::call()
> at LzEvent/sendEvent()
> at LzIdleKernel$/__update()
> ===
>
> it generates the following actionscript:
> ===
> package {
> dynamic class $lzc$class_m2 extends LzView {
> /* -*- file: test-layout.lzx#3 -*- */
> static var displayName = "<anonymous extends='view'>";static var children = [{attrs: {text: "one"}, "class": LzText}, {attrs: {text: "two"}, "class": LzText}];static var attributes = new LzInheritedHash(LzView.attributes);function $m1 ($0) {
> this.setAttribute("layout", new (lz.simplelayout)(this, {axis: "x", spacing: 10}))
> }
> /* -*- file: -*- */
> function $lzc$class_m2 ($0:LzNode? = null, $1:Object? = null, $2:Array? = null, $3:Boolean = false) {
> super($0, $1, $2, $3)
> }
> }
> }
> ===
>
> am i creating the simplelayout correctly?
>
> augusto.
More information about the Laszlo-dev
mailing list