home *** CD-ROM | disk | FTP | other *** search
- class com.argosy.ui.CButton extends com.argosy.ui.baseUI
- {
- var label_str;
- var label_tf;
- var button_style;
- var button_bg;
- var glow_filter;
- var drop_shadow;
- var dispatchEvent;
- var button_height = 20;
- function CButton()
- {
- super();
- }
- function set label(str)
- {
- this.label_str = str;
- this.label_tf.htmlText = "<p><up>" + this.label_str + "</up></p>";
- this.setSize(this.label_tf._width * 1.5,this.button_height);
- }
- function get label()
- {
- return this.label_str;
- }
- function init()
- {
- this.button_style = new TextField.StyleSheet();
- this.button_style.setStyle("up",{fontFamily:"Frutiger Bold",fontSize:"10",color:"#000000",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- this.button_style.setStyle("over",{fontFamily:"Frutiger Bold",fontSize:"10",color:"#438CB8",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- super.init();
- this.label = "Button";
- }
- function createChildren()
- {
- this.button_bg = this.createEmptyMovieClip("button_bg",1);
- this.label_tf = this._createTextField(this,"label_tf",2,0,5,1,1,this.button_style,"");
- this.label_tf.autoSize = true;
- this.glow_filter = new flash.filters.GlowFilter(4426936,1,5,5,1,3,false,false);
- this.drop_shadow = new flash.filters.DropShadowFilter(2,45,0,1,5,5,1,3,false,false,false);
- this.button_bg.filters = [this.drop_shadow];
- this.button_bg.onRollOver = ascb.util.Proxy.create(this,this._rollOver);
- this.button_bg.onRollOut = ascb.util.Proxy.create(this,this._rollOut);
- this.button_bg.onPress = ascb.util.Proxy.create(this,this._press);
- this.button_bg.onRelease = ascb.util.Proxy.create(this,this._release);
- this.button_bg.onReleaseOutside = ascb.util.Proxy.create(this,this._rollOut);
- }
- function _rollOver()
- {
- this.label_tf.htmlText = "<p><over>" + this.label_str + "</over></p>";
- this.button_bg.filters = [this.glow_filter,this.drop_shadow];
- }
- function _rollOut()
- {
- this.label_tf.htmlText = "<p><up>" + this.label_str + "</up></p>";
- this.button_bg.filters = [this.drop_shadow];
- }
- function _press()
- {
- this.label_tf.htmlText = "<p><over>" + this.label_str + "</over></p>";
- this.button_bg.filters = [this.glow_filter,this.drop_shadow];
- this.dispatchEvent({type:"press",target:this});
- }
- function _release()
- {
- this.label_tf.htmlText = "<p><up>" + this.label_str + "</up></p>";
- this.button_bg.filters = [this.drop_shadow];
- this.dispatchEvent({type:"release",target:this});
- }
- function layout()
- {
- this.label_tf._x = this.width / 2 - this.label_tf.textWidth / 2 - 2;
- this.label_tf._y = this.height / 2 - this.label_tf.textHeight / 2 - 2;
- this.button_bg.clear();
- var _loc2_ = new flash.geom.Matrix();
- _loc2_.createGradientBox(this.width,this.height,1.5707963267948966,0,0);
- this.button_bg.lineStyle(1,0,100);
- this.button_bg.beginFill(16777215,100);
- com.drawing.drawUtil.drawRect(this.button_bg,0,0,this.width,this.height,0);
- this.button_bg.endFill();
- }
- }
-