home *** CD-ROM | disk | FTP | other *** search
/ Ice Age Fan CD 1 / CD1_Scrat.iso / flash / data / game.swf / scripts / com / google / analytics / debug / Alert.as < prev    next >
Encoding:
Text File  |  2012-07-04  |  3.5 KB  |  139 lines

  1. package com.google.analytics.debug
  2. {
  3.    import flash.events.TextEvent;
  4.    
  5.    public class Alert extends Label
  6.    {
  7.       public var autoClose:Boolean = true;
  8.       
  9.       public var actionOnNextLine:Boolean = true;
  10.       
  11.       private var _actions:Array;
  12.       
  13.       public function Alert(param1:String, param2:Array, param3:String = "uiAlert", param4:uint = 0, param5:Align = null, param6:Boolean = false, param7:Boolean = true)
  14.       {
  15.          if(param4 == 0)
  16.          {
  17.             param4 = uint(Style.alertColor);
  18.          }
  19.          if(param5 == null)
  20.          {
  21.             param5 = Align.center;
  22.          }
  23.          super(param1,param3,param4,param5,param6);
  24.          this.selectable = true;
  25.          super.mouseChildren = true;
  26.          this.buttonMode = true;
  27.          this.mouseEnabled = true;
  28.          this.useHandCursor = true;
  29.          this.actionOnNextLine = param7;
  30.          _actions = [];
  31.          var _loc8_:int = 0;
  32.          while(_loc8_ < param2.length)
  33.          {
  34.             param2[_loc8_].container = this;
  35.             _actions.push(param2[_loc8_]);
  36.             _loc8_++;
  37.          }
  38.       }
  39.       
  40.       private function _defineActions() : void
  41.       {
  42.          var _loc3_:AlertAction = null;
  43.          var _loc1_:* = "";
  44.          if(actionOnNextLine)
  45.          {
  46.             _loc1_ += "\n";
  47.          }
  48.          else
  49.          {
  50.             _loc1_ += " |";
  51.          }
  52.          _loc1_ += " ";
  53.          var _loc2_:Array = [];
  54.          var _loc4_:int = 0;
  55.          while(_loc4_ < _actions.length)
  56.          {
  57.             _loc3_ = _actions[_loc4_];
  58.             _loc2_.push("<a href=\"event:" + _loc3_.activator + "\">" + _loc3_.name + "</a>");
  59.             _loc4_++;
  60.          }
  61.          _loc1_ += _loc2_.join(" | ");
  62.          appendText(_loc1_,"uiAlertAction");
  63.       }
  64.       
  65.       protected function isValidAction(param1:String) : Boolean
  66.       {
  67.          var _loc2_:int = 0;
  68.          while(_loc2_ < _actions.length)
  69.          {
  70.             if(param1 == _actions[_loc2_].activator)
  71.             {
  72.                return true;
  73.             }
  74.             _loc2_++;
  75.          }
  76.          return false;
  77.       }
  78.       
  79.       override protected function layout() : void
  80.       {
  81.          super.layout();
  82.          _defineActions();
  83.       }
  84.       
  85.       protected function getAction(param1:String) : AlertAction
  86.       {
  87.          var _loc2_:int = 0;
  88.          while(_loc2_ < _actions.length)
  89.          {
  90.             if(param1 == _actions[_loc2_].activator)
  91.             {
  92.                return _actions[_loc2_];
  93.             }
  94.             _loc2_++;
  95.          }
  96.          return null;
  97.       }
  98.       
  99.       protected function spaces(param1:int) : String
  100.       {
  101.          var _loc2_:String = "";
  102.          var _loc3_:String = "          ";
  103.          var _loc4_:int = 0;
  104.          while(_loc4_ < param1 + 1)
  105.          {
  106.             _loc2_ += _loc3_;
  107.             _loc4_++;
  108.          }
  109.          return _loc2_;
  110.       }
  111.       
  112.       override public function onLink(param1:TextEvent) : void
  113.       {
  114.          var _loc2_:AlertAction = null;
  115.          if(isValidAction(param1.text))
  116.          {
  117.             _loc2_ = getAction(param1.text);
  118.             if(_loc2_)
  119.             {
  120.                _loc2_.execute();
  121.             }
  122.          }
  123.          if(autoClose)
  124.          {
  125.             close();
  126.          }
  127.       }
  128.       
  129.       public function close() : void
  130.       {
  131.          if(parent != null)
  132.          {
  133.             parent.removeChild(this);
  134.          }
  135.       }
  136.    }
  137. }
  138.  
  139.