home *** CD-ROM | disk | FTP | other *** search
/ ftp.novell.com / 2014.06.ftp.novell.com.tar / ftp.novell.com / forge / camtasia.msi / Cabs.w1.cab / fp8_controller.swf2202 / scripts / __Packages / mx / controls / Alert.as next >
Text File  |  2009-08-19  |  5KB  |  166 lines

  1. class mx.controls.Alert extends mx.containers.Window
  2. {
  3.    static var symbolOwner = mx.containers.Window;
  4.    static var version = "2.0.2.126";
  5.    static var buttonWidth = 50;
  6.    static var buttonHeight = 22;
  7.    static var okLabel = "OK";
  8.    static var yesLabel = "Yes";
  9.    static var noLabel = "No";
  10.    static var cancelLabel = "Cancel";
  11.    static var buttonUp = "ButtonSkin";
  12.    static var buttonDown = "ButtonSkin";
  13.    static var buttonOver = "ButtonSkin";
  14.    static var titleBackground = "TitleBackground";
  15.    static var buttonUpEmphasized = "ButtonSkin";
  16.    static var buttonOverEmphasized = "ButtonSkin";
  17.    static var buttonDownEmphasized = "ButtonSkin";
  18.    var className = "Alert";
  19.    var allowSize = false;
  20.    static var NONMODAL = 32768;
  21.    static var YES = 1;
  22.    static var NO = 2;
  23.    static var OK = 4;
  24.    static var CANCEL = 8;
  25.    static var P = _root;
  26.    function Alert()
  27.    {
  28.       super();
  29.    }
  30.    static function show(text, title, flags, parent, listener, icon, defButton)
  31.    {
  32.       var _loc2_ = new Object();
  33.       var _loc6_ = !(flags & mx.controls.Alert.NONMODAL) ? true : false;
  34.       if(parent == undefined)
  35.       {
  36.          var _loc0_ = null;
  37.          parent = _loc2_.parent = _root;
  38.       }
  39.       else
  40.       {
  41.          _loc2_.parent = parent;
  42.       }
  43.       _loc2_.okButton = !(flags & mx.controls.Alert.OK) ? false : true;
  44.       _loc2_.cancelButton = !(flags & mx.controls.Alert.CANCEL) ? false : true;
  45.       _loc2_.yesButton = !(flags & mx.controls.Alert.YES) ? false : true;
  46.       _loc2_.noButton = !(flags & mx.controls.Alert.NO) ? false : true;
  47.       _loc2_.defButton = defButton;
  48.       if(_loc2_.okButton == false && _loc2_.cancelButton == false && _loc2_.yesButton == false && _loc2_.noButton == false)
  49.       {
  50.          _loc2_.okButton = true;
  51.          _loc2_.defButton = mx.controls.Alert.OK;
  52.       }
  53.       _loc2_.title = title;
  54.       _loc2_.text = text;
  55.       _loc2_.icon = icon;
  56.       _loc2_.style = mx.controls.Alert.style;
  57.       _loc2_.skinTitleBackground = mx.controls.Alert.titleBackground;
  58.       _loc2_.titleStyleDeclaration = mx.controls.Alert.titleStyleDeclaration;
  59.       _loc2_.validateNow = true;
  60.       var _loc4_ = mx.managers.PopUpManager.createPopUp(parent,mx.controls.Alert,_loc6_,_loc2_);
  61.       if(_loc4_ == undefined)
  62.       {
  63.          trace("Failed to create a new alert, probably because there is no Alert in the Library");
  64.       }
  65.       _loc4_.addEventListener("click",listener);
  66.       return _loc4_;
  67.    }
  68.    function init(Void)
  69.    {
  70.       super.init();
  71.       this.__set__visible(false);
  72.    }
  73.    function createChildren(Void)
  74.    {
  75.       if(mx.controls.Alert.messageStyleDeclaration != undefined)
  76.       {
  77.          this.styleName = mx.controls.Alert.messageStyleDeclaration;
  78.       }
  79.       var _loc3_ = mx.controls.alertClasses.AlertForm;
  80.       this.__set__contentPath(_loc3_);
  81.       super.createChildren();
  82.    }
  83.    function getViewMetrics(Void)
  84.    {
  85.       var _loc2_ = super.getViewMetrics();
  86.       return _loc2_;
  87.    }
  88.    function doLayout(Void)
  89.    {
  90.       super.doLayout();
  91.    }
  92.    function draw(Void)
  93.    {
  94.       var _loc9_ = this.initializing;
  95.       super.draw();
  96.       if(_loc9_)
  97.       {
  98.          var _loc5_ = new Object();
  99.          _loc5_.x = this.parent._x;
  100.          _loc5_.y = this.parent._y;
  101.          this.parent.localToGlobal(_loc5_);
  102.          var _loc7_ = this.parent.width;
  103.          var _loc8_ = this.parent.height;
  104.          if(this.parent == _root && this.parent._parent == undefined || _loc7_ == undefined)
  105.          {
  106.             var _loc6_ = mx.managers.SystemManager.__get__screen();
  107.             _loc7_ = _loc6_.width;
  108.             _loc8_ = _loc6_.height;
  109.             _loc5_.x = _loc6_.x;
  110.             _loc5_.y = _loc6_.y;
  111.          }
  112.          if(_global.isLivePreview)
  113.          {
  114.             return undefined;
  115.          }
  116.          _loc5_.x += (_loc7_ - this.__get__width()) / 2;
  117.          _loc5_.y += (_loc8_ - this.__get__height()) / 2;
  118.          this.parent.globalToLocal(_loc5_);
  119.          this.move(_loc5_.x,_loc5_.y);
  120.          if(this._child0.defButtonName != undefined)
  121.          {
  122.             this._child0[this._child0.defButtonName].setFocus();
  123.          }
  124.          else
  125.          {
  126.             this._child0.buttons[0].setFocus();
  127.          }
  128.       }
  129.    }
  130.    function size(Void)
  131.    {
  132.       if(_global.isLivePreview)
  133.       {
  134.          this.__width = this.width;
  135.          this.__height = this.height;
  136.       }
  137.       else
  138.       {
  139.          var _loc4_ = this._child0.getSize();
  140.          if(isNaN(_loc4_.width) || _loc4_.width < 20)
  141.          {
  142.             _loc4_.width = 96;
  143.          }
  144.          if(isNaN(_loc4_.height) || _loc4_.height < 20)
  145.          {
  146.             _loc4_.height = 66;
  147.          }
  148.          var _loc5_ = this.border_mc.__get__borderMetrics();
  149.          if(!this.allowSize)
  150.          {
  151.             this.__width = _loc4_.width + 2 * _loc5_.left;
  152.             this.__height = _loc4_.height + _loc5_.top + _loc5_.bottom + this.back_mc.height;
  153.             this.allowSize = false;
  154.          }
  155.       }
  156.       super.size();
  157.    }
  158.    function setSize(w, h)
  159.    {
  160.       this.__width = w;
  161.       this.__height = h;
  162.       this.initializing = this.allowSize = true;
  163.       this.invalidate();
  164.    }
  165. }
  166.