home *** CD-ROM | disk | FTP | other *** search
- class com.argosy.ui.AlertBox extends com.argosy.ui.baseUI
- {
- var passed_argurments;
- var callback_owner;
- var callback_name;
- var title_tf;
- var body_tf;
- var yes_button;
- var no_button;
- var normal_style;
- var mouseCatcher;
- var bg;
- var drop_shadow;
- var bevel_filter;
- var alert_width = 400;
- function AlertBox()
- {
- super();
- }
- function setContent(title, body, confirm_text, cancel_text, event_owner, event_name)
- {
- trace("Alert setContent: " + arguments);
- if(arguments.length > 6)
- {
- this.passed_argurments = arguments.splice(6,arguments.length);
- }
- else
- {
- this.passed_argurments = [];
- }
- this.callback_owner = event_owner;
- this.callback_name = event_name;
- this.title_tf.htmlText = "<p><title>" + title + "</title></p>";
- this.body_tf.htmlText = "<p>" + body + "</p>";
- this.yes_button.label = confirm_text;
- if(cancel_text == null)
- {
- this.no_button._visible = false;
- }
- else
- {
- this.no_button._visible = true;
- this.no_button.label = cancel_text;
- }
- this.layout_components();
- this._visible = true;
- }
- function button_press_yes(evt)
- {
- trace("Alert Selection: " + arguments);
- this.passed_argurments.push(true);
- this.callback_owner[this.callback_name].apply(this.callback_owner,this.passed_argurments);
- this._visible = false;
- }
- function button_press_no(evt)
- {
- trace("Alert Selection: " + arguments);
- this.passed_argurments.push(false);
- this.callback_owner[this.callback_name].apply(this.callback_owner,this.passed_argurments);
- this._visible = false;
- }
- function init()
- {
- this.normal_style = new TextField.StyleSheet();
- this.normal_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#333333",textAlign:"left",textDecoration:"none",kerning:"true",letterSpacing:"0"});
- this.normal_style.setStyle("title",{fontFamily:"Frutiger Bold",fontSize:"14",color:"#438CB8"});
- super.init();
- this._visible = false;
- }
- function createChildren()
- {
- this.mouseCatcher = this.createEmptyMovieClip("bg",1);
- this.mouseCatcher.onPress = function()
- {
- };
- this.mouseCatcher.useHandCursor = false;
- this.bg = this.createEmptyMovieClip("bg",2);
- this.title_tf = this._createTextField(this,"title_tf",5,0,0,this.width,20,this.normal_style,"");
- this.body_tf = this._createTextField(this,"body_tf",6,0,0,this.width,20,this.normal_style,"");
- this.body_tf.multiline = true;
- this.body_tf.wordWrap = true;
- this.body_tf.autoSize = true;
- this.yes_button = this.attachMovie("CButton","yes_button",10);
- this.yes_button.addEventListener("release",this,"button_press_yes",true);
- this.yes_button.label = "OK";
- this.no_button = this.attachMovie("CButton","yes_button",11);
- this.no_button.addEventListener("release",this,"button_press_no",false);
- this.no_button.label = "CANCEL";
- this.drop_shadow = new flash.filters.DropShadowFilter(5,45,0,0.8,10,10,1,3);
- this.bevel_filter = new flash.filters.BevelFilter(5,45,16777215,0.8,0,0.8,20,20,1,3,"inner",false);
- this.bg.filters = [this.drop_shadow];
- this.setSize(this.alert_width,100);
- }
- function layout_components()
- {
- this.title_tf._x = 5;
- this.title_tf._y = 5;
- this.body_tf._x = 5;
- this.body_tf._y = this.title_tf._y + this.title_tf._height + 10;
- this.yes_button._x = this.alert_width - this.yes_button._width - 5;
- this.yes_button._y = this.body_tf._y + this.body_tf._height + 10;
- this.no_button._x = this.yes_button._x - this.no_button._width - 5;
- this.no_button._y = this.yes_button._y;
- this.setSize(this.alert_width,this.no_button._y + this.no_button._height + 10);
- }
- function layout()
- {
- this.mouseCatcher.clear();
- this.mouseCatcher._x = 0;
- this.mouseCatcher._y = 0;
- this.title_tf._width = this.alert_width - 10;
- this.body_tf._width = this.alert_width - 10;
- this.bg.clear();
- var _loc3_ = new flash.geom.Matrix();
- _loc3_.createGradientBox(this.width,this.height,1.5707963267948966,0,0);
- this.bg.lineStyle(2,4426936,80);
- this.bg.beginGradientFill("linear",[14409183,10856103],[100,100],[0,255],_loc3_,"pad");
- 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.lineStyle(0,4426936,10,false,"normal","square","miter",8);
- this.bg.moveTo(1,this.body_tf._y - 10);
- this.bg.lineTo(this.width - 1,this.body_tf._y - 10);
- var _loc2_ = {x:Stage.width / 2 - this.width / 2,y:Stage.height / 2 - this.height / 2};
- this._parent.globalToLocal(_loc2_);
- this._x = _loc2_.x;
- this._y = _loc2_.y;
- this.mouseCatcher._x = - this._x;
- this.mouseCatcher._y = - this._y;
- this.mouseCatcher.beginFill(16777215,20);
- com.drawing.drawUtil.drawRect(this.mouseCatcher,0,0,this._parent._width,this._parent._height,0);
- this.mouseCatcher.endFill();
- }
- }
-