[Laszlo-dev] "Instantiation attempted on a non-constructor" when creating a layout programmatically?

augusto callejas augusto at qless.com
Mon Mar 19 14:21:28 PDT 2012


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