home *** CD-ROM | disk | FTP | other *** search
- class com.techsmith.widgets.button.TSButton extends com.techsmith.widgets.button.TSSimpleButton
- {
- var m_label = null;
- var m_labelField = null;
- var m_labelFormat = null;
- var m_width = null;
- var m_height = 27;
- var m_graphic = null;
- var m_disabledColor = 13555676;
- var m_enabledColor = 0;
- function TSButton()
- {
- super();
- }
- static function create(container, name, depth, init)
- {
- com.techsmith.widgets.button.TSButton.bind();
- var _loc1_ = container.attachMovie("TSButton",name,depth,init);
- return com.techsmith.widgets.button.TSButton(_loc1_);
- }
- static function bind()
- {
- Object.registerClass("TSButtonUp",com.techsmith.widgets.button.panels.TSButtonUp);
- Object.registerClass("TSButtonOver",com.techsmith.widgets.button.panels.TSButtonOver);
- Object.registerClass("TSButtonDown",com.techsmith.widgets.button.panels.TSButtonDown);
- Object.registerClass("TSButtonDisabled",com.techsmith.widgets.button.panels.TSButtonDisabled);
- }
- function init(label, width, toggle, tf, bs)
- {
- if(label == null || label == undefined)
- {
- label = "";
- }
- if(width == null || width == undefined)
- {
- width = 100;
- }
- if(toggle == null || toggle == undefined)
- {
- toggle = false;
- }
- if(bs == null || bs == undefined)
- {
- bs = new com.techsmith.widgets.button.TSButtonStyle("TSButton",null,toggle);
- }
- this.m_label = label;
- this.m_width = width;
- super.init(bs);
- this.m_graphic.init(this.m_width);
- this.createLabelField();
- this.createTextFormat(tf);
- this.setLabel(this.m_label);
- }
- function createLabelField()
- {
- this.createTextField("m_labelField",10,0,0,this.m_width,this.m_height - 5);
- this.m_labelField._y = (this.m_height - this.m_labelField._height) / 2 + 2;
- this.m_labelField.html = true;
- }
- function createTextFormat(obj)
- {
- if(obj == null || obj == undefined)
- {
- this.m_labelFormat = new TextFormat();
- this.m_labelFormat.align = "center";
- this.m_labelFormat.font = "Arial";
- this.m_labelFormat.size = 12;
- this.m_labelFormat.leftMargin = 2;
- this.m_labelFormat.rightMargin = 2;
- this.m_labelFormat.color = 0;
- }
- else
- {
- this.m_labelFormat = obj;
- }
- this.m_enabledColor = this.m_labelFormat.color;
- }
- function draw()
- {
- this.createLabelField();
- this.m_graphic.setSize(this.m_width,this.m_height);
- this.setLabel(this.m_label);
- }
- function setSize(width, height)
- {
- this.m_width = width;
- this.draw();
- }
- function setLabel(label)
- {
- this.m_label = label;
- this.m_labelField.htmlText = this.m_label;
- this.m_labelField.setTextFormat(this.m_labelFormat);
- }
- function setEnabled(enable)
- {
- super.setEnabled(enable);
- this.m_graphic.init(this.m_width);
- if(enable)
- {
- this.m_labelFormat.color = this.m_enabledColor;
- }
- else
- {
- this.m_labelFormat.color = this.m_disabledColor;
- }
- this.setLabel(this.m_label);
- }
- function onRollOver()
- {
- super.onRollOver();
- this.m_graphic.init(this.m_width);
- }
- function onRollOut()
- {
- super.onRollOut();
- this.m_graphic.init(this.m_width);
- }
- function onPress()
- {
- super.onPress();
- this.m_graphic.init(this.m_width);
- }
- function onRelease()
- {
- super.onRelease();
- this.m_graphic.init(this.m_width);
- }
- function onReleaseOutside()
- {
- super.onReleaseOutside();
- this.m_graphic.init(this.m_width);
- }
- }
-