mybutton.lzx
<library>
<resource name="mybutton_rsc">
<frame src="resources/button/mybutton_mouseup.png"/>
<frame src="resources/button/mybutton_mouseover.png"/>
<frame src="resources/button/mybutton_mousedown.png"/>
<frame src="resources/button/mybutton_disabled.png"/>
</resource>
<class name="mybutton" resource="mybutton_rsc">
<attribute name="enabled" value="true
"/>
<attribute name="normalResourceNumber" type="number" value="1
"/>
<attribute name="overResourceNumber" type="number" value="2
"/>
<attribute name="downResourceNumber" type="number" value="3
"/>
<attribute name="disabledResourceNumber" type="number" value="4
"/>
<attribute name="_msdown" value="false
"/>
<attribute name="_msin" value="false
"/>
<attribute name="_enabled" value="true
"/>
<method name="_callShow">
if ( this._msdown && this._msin) {
this.showDown();
} else if ( this._msin ) {
this.showOver();
} else {
this.showUp();
}
</method>
<method name="init">
// now that subviews are created reset resourceviewcount
super.init();
this._callShow();
</method>
<handler name="onmouseover">
this.setAttribute( '_msin' , true );
this._callShow();
</handler>
<handler name="onmouseout">
this.setAttribute( '_msin' , false );
this._callShow();
</handler>
<handler name="onmousedown">
this.setAttribute( '_msdown' , true );
this._callShow();
</handler>
<handler name="onmouseup">
this.setAttribute( '_msdown' , false );
this._callShow();
</handler>
<method name="_showEnabled">
showUp();
</method>
<method name="showDown" args="sd=null">
this.setAttribute('frame', this.downResourceNumber );
</method>
<method name="showUp" args="sd=null">
if (!_enabled && this.disabledResourceNumber) {
this.setAttribute('frame', this.disabledResourceNumber );
} else {
this.setAttribute('frame', this.normalResourceNumber );
}
</method>
<method name="showOver" args="sd=null">
this.setAttribute('frame', this.overResourceNumber );
</method>
</class>
</library>
Cross References
Resources
Classes