home *** CD-ROM | disk | FTP | other *** search
- class com.techsmith.widgets.button.TSSimpleButton extends com.techsmith.widgets.Movable implements com.techsmith.utils.events.IEventDispatcher
- {
- var m_dispatcher = null;
- var m_fToggleState = null;
- var m_styleObj = null;
- var m_graphic = null;
- var m_toggle = null;
- var m_fGraphicY = 0;
- var m_fGraphicX = 0;
- var m_mouseState = null;
- function TSSimpleButton()
- {
- super();
- this.useHandCursor = false;
- this.m_dispatcher = new com.techsmith.utils.events.EventDispatcher();
- this.m_fToggleState = true;
- this.m_toggle = false;
- }
- static function create(container, name, depth, init)
- {
- var _loc1_ = container.attachMovie("TSSimpleButton",name,depth,init);
- return com.techsmith.widgets.button.TSSimpleButton(_loc1_);
- }
- function init(styleObj)
- {
- this.m_styleObj = styleObj;
- this.m_toggle = styleObj.m_toggle;
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseUpSkin,"m_graphic",5);
- }
- this.positionIcon();
- }
- function positionIcon()
- {
- this.m_graphic._x = this.m_fGraphicX;
- this.m_graphic._y = this.m_fGraphicY;
- }
- function onRollOver()
- {
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueOverSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueOverSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseOverSkin,"m_graphic",5);
- }
- this.positionIcon();
- }
- function onPress()
- {
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueDownSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueDownSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseDownSkin,"m_graphic",5);
- }
- this.positionIcon();
- }
- function onRelease()
- {
- this.m_fToggleState = !this.m_fToggleState ? true : false;
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueOverSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueOverSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseOverSkin,"m_graphic",5);
- }
- this.positionIcon();
- this.sendEvent({target:this,type:"click"});
- }
- function onReleaseOutside()
- {
- this.m_fToggleState = !this.m_fToggleState ? true : false;
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseUpSkin,"m_graphic",5);
- }
- this.positionIcon();
- }
- function onRollOut()
- {
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseUpSkin,"m_graphic",5);
- }
- this.positionIcon();
- }
- function setEnabled(enable)
- {
- this.enabled = enable;
- if(!enable)
- {
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueDisabledSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueDisabledSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseDisabledSkin,"m_graphic",5);
- }
- }
- else if(enable)
- {
- if(!this.m_toggle)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else if(this.m_fToggleState)
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_trueUpSkin,"m_graphic",5);
- }
- else
- {
- this.m_graphic = this.attachMovie(this.m_styleObj.m_falseUpSkin,"m_graphic",5);
- }
- }
- this.positionIcon();
- }
- function sendEvent(e)
- {
- this.dispatchEvent(e);
- }
- function addEventListener(event, scope)
- {
- this.m_dispatcher.addEventListener(event,scope);
- }
- function removeEventListener(event, scope)
- {
- this.m_dispatcher.removeEventListener(event,scope);
- }
- function dispatchEvent(eventObj)
- {
- this.m_dispatcher.dispatchEvent(eventObj);
- }
- }
-