home *** CD-ROM | disk | FTP | other *** search
- class com.argosy.ui.InputField extends com.argosy.ui.baseUI
- {
- var text_tf;
- var text_format;
- var bg;
- var outline_mc;
- var drop_shadow;
- var dispatchEvent;
- function InputField()
- {
- super();
- }
- function setLimit(limit_num, limit_str)
- {
- this.text_tf.maxChars = limit_num;
- this.text_tf.restrict = limit_str;
- }
- function set text(str)
- {
- this.text_tf.text = str;
- }
- function get text()
- {
- return this.text_tf.text;
- }
- function set type(str)
- {
- this.text_tf.type = str;
- }
- function get type()
- {
- return this.text_tf.type;
- }
- function set textEnabled(b)
- {
- if(b)
- {
- this.text_tf.type = "input";
- }
- else
- {
- this.text_tf.type = "dynamic";
- }
- }
- function init()
- {
- this.text_format = new TextFormat();
- this.text_format.font = "Frutiger";
- this.text_format.size = 14;
- this.text_format.color = 2046576;
- this.text_format.kerning = true;
- this.text_format.align = "left";
- super.init();
- }
- function createChildren()
- {
- this.bg = this.createEmptyMovieClip("bg",1);
- this.outline_mc = this.createEmptyMovieClip("menu",2);
- this.outline_mc._visible = false;
- this.text_tf = this.createTextField("text_tf",3,0,0,this.width,this.height);
- this.text_tf.type = "input";
- this.text_tf.embedFonts = true;
- this.text_tf.setNewTextFormat(this.text_format);
- this.text_tf.onSetFocus = ascb.util.Proxy.create(this,this.gainFocus);
- this.text_tf.onKillFocus = ascb.util.Proxy.create(this,this.loseFocus);
- this.text_tf.onChanged = ascb.util.Proxy.create(this,this.textChanged);
- this.text_tf.tabIndex = 1;
- this.drop_shadow = new flash.filters.DropShadowFilter(0,0,0,0.8,5,5,1,3,true,false,false);
- }
- function textChanged()
- {
- this.dispatchEvent({type:"textChanged",target:this.text_tf});
- }
- function gainFocus()
- {
- this.outline_mc._visible = true;
- }
- function loseFocus()
- {
- this.outline_mc._visible = false;
- }
- function layout()
- {
- this.bg.clear();
- this.bg.lineStyle(0,13421772,100);
- this.bg.beginFill(16777215,100);
- this.bg.lineTo(this.width,0);
- this.bg.lineTo(this.width,this.height);
- this.bg.lineTo(0,this.height);
- this.bg.lineTo(0,0);
- this.bg.endFill();
- this.bg.filters = [this.drop_shadow];
- this.outline_mc.clear();
- this.outline_mc.lineStyle(2,4426936,100);
- this.outline_mc.lineTo(this.width,0);
- this.outline_mc.lineTo(this.width,this.height);
- this.outline_mc.lineTo(0,this.height);
- this.outline_mc.lineTo(0,0);
- this.text_tf._y = 2;
- this.text_tf._x = 2;
- this.text_tf._width = this.width - 4;
- this.text_tf._height = this.height - 4;
- }
- }
-