Hi all,
Here's a simple JS2 class I wrote for testing. What would be the exact LZX
representation be? I'm trying do better understand instantiation of LZX
based classes and JS2 based classes. Either I made a mistake or I see some
differences for classes I port from LZX to JS2 syntax.
<library>
<!-- testclassjs2, want to see how JS2 compares to LZX.
-->
<interface name="testclassjs2" extends="node">
<!--- A test attribute.
@type String
@access private
-->
<attribute name="src" value="" type="string"/>
</interface>
<!-- these methods are shared across runtimes -->
<script when="immediate"><![CDATA[
mixin Testclassjs2Shared {
function Testclassjs2Shared ( parent:LzView? = null , attrs:Object?
= null , children:Array? = null, instcall:Boolean = false) {
super(parent, attrs, children, instcall);
}
}
]]></script>
<script when="immediate"><![CDATA[
// Classes that implement an interface must obey the LZX
// tag->class mapping convention
dynamic class $lzc$class_testclassjs2 extends LzView with
Testclassjs2Shared {
// Next two are part of the required LFC tag class protocol
static var tagname = 'testclassjs2';
static var attributes = new LzInheritedHash(LzView.attributes);
static var uid = 0;
var src = "";
var onsrc = LzDeclaredEvent;
override function construct(parent,args) {
super.construct(parent, args);
Debug.write("constructor");
new LzDelegate( this , "_oninit" , this , "oninit" );
new LzDelegate( this, "_onSrc", this, "onsrc");
}
function $lzc$class_testclassjs2(parent, attrs, children, async) {
super(parent, attrs, children, async);
}
override function init() {
super.init();
Debug.write(this, "init()");
}
function _oninit(ignore) {
Debug.write(this, "_oninit()");
}
function _setSrc(value) {
Debug.write(this, "_setSrc()", value);
this.src = value;
}
function $lzc$set_src(value) {
Debug.write(this, "$lzc$set_src()", value);
this._setSrc(value);
this.onsrc.sendEvent(this);
}
function _onSrc (evt) {
Debug.write(this, "_onSrc()", evt);
}
} // End of testclassjs2
lz[$lzc$class_testclassjs2.tagname] = $lzc$class_testclassjs2;
]]></script>
</library>
Thanks,
Raju