home *** CD-ROM | disk | FTP | other *** search
/ Hentai Interactivo 57 / HENTAI57.bin / flip3.swf / scripts / __Packages / mx / core / ext / UIObjectExtensions.as < prev   
Encoding:
Text File  |  2008-11-04  |  7.1 KB  |  228 lines

  1. class mx.core.ext.UIObjectExtensions
  2. {
  3.    var __enabled;
  4.    var invalidateStyle;
  5.    var invalidateFlag;
  6.    var _getTextFormat;
  7.    var setTextFormat;
  8.    var setNewTextFormat;
  9.    var embedFonts;
  10.    var __text;
  11.    var text;
  12.    var _visible;
  13.    var textColor;
  14.    var getValue;
  15.    var setValue;
  16.    var stylecache;
  17.    var __getTextFormat;
  18.    var enabledColor;
  19.    var getTextFormat;
  20.    var getStyle;
  21.    var draw;
  22.    var textWidth;
  23.    var textHeight;
  24.    var align;
  25.    static var bExtended = false;
  26.    static var UIObjectExtended = mx.core.ext.UIObjectExtensions.Extensions();
  27.    static var UIObjectDependency = mx.core.UIObject;
  28.    static var SkinElementDependency = mx.skins.SkinElement;
  29.    static var CSSTextStylesDependency = mx.styles.CSSTextStyles;
  30.    static var UIEventDispatcherDependency = mx.events.UIEventDispatcher;
  31.    function UIObjectExtensions()
  32.    {
  33.    }
  34.    static function addGeometry(tf, ui)
  35.    {
  36.       tf.addProperty("width",ui.__get__width,null);
  37.       tf.addProperty("height",ui.__get__height,null);
  38.       tf.addProperty("left",ui.__get__left,null);
  39.       tf.addProperty("x",ui.__get__x,null);
  40.       tf.addProperty("top",ui.__get__top,null);
  41.       tf.addProperty("y",ui.__get__y,null);
  42.       tf.addProperty("right",ui.__get__right,null);
  43.       tf.addProperty("bottom",ui.__get__bottom,null);
  44.       tf.addProperty("visible",ui.__get__visible,ui.__set__visible);
  45.    }
  46.    static function Extensions()
  47.    {
  48.       if(mx.core.ext.UIObjectExtensions.bExtended == true)
  49.       {
  50.          return true;
  51.       }
  52.       mx.core.ext.UIObjectExtensions.bExtended = true;
  53.       var _loc6_ = mx.core.UIObject.prototype;
  54.       var _loc9_ = mx.skins.SkinElement.prototype;
  55.       mx.core.ext.UIObjectExtensions.addGeometry(_loc9_,_loc6_);
  56.       mx.events.UIEventDispatcher.initialize(_loc6_);
  57.       var _loc13_ = mx.skins.ColoredSkinElement;
  58.       mx.styles.CSSTextStyles.addTextStyles(_loc6_);
  59.       var _loc5_ = MovieClip.prototype;
  60.       _loc5_.getTopLevel = _loc6_.getTopLevel;
  61.       _loc5_.createLabel = _loc6_.createLabel;
  62.       _loc5_.createObject = _loc6_.createObject;
  63.       _loc5_.createClassObject = _loc6_.createClassObject;
  64.       _loc5_.createEmptyObject = _loc6_.createEmptyObject;
  65.       _loc5_.destroyObject = _loc6_.destroyObject;
  66.       _global.ASSetPropFlags(_loc5_,"getTopLevel",1);
  67.       _global.ASSetPropFlags(_loc5_,"createLabel",1);
  68.       _global.ASSetPropFlags(_loc5_,"createObject",1);
  69.       _global.ASSetPropFlags(_loc5_,"createClassObject",1);
  70.       _global.ASSetPropFlags(_loc5_,"createEmptyObject",1);
  71.       _global.ASSetPropFlags(_loc5_,"destroyObject",1);
  72.       _loc5_.__getTextFormat = _loc6_.__getTextFormat;
  73.       _loc5_._getTextFormat = _loc6_._getTextFormat;
  74.       _loc5_.getStyleName = _loc6_.getStyleName;
  75.       _loc5_.getStyle = _loc6_.getStyle;
  76.       _global.ASSetPropFlags(_loc5_,"__getTextFormat",1);
  77.       _global.ASSetPropFlags(_loc5_,"_getTextFormat",1);
  78.       _global.ASSetPropFlags(_loc5_,"getStyleName",1);
  79.       _global.ASSetPropFlags(_loc5_,"getStyle",1);
  80.       var _loc7_ = TextField.prototype;
  81.       mx.core.ext.UIObjectExtensions.addGeometry(_loc7_,_loc6_);
  82.       _loc7_.addProperty("enabled",function()
  83.       {
  84.          return this.__enabled;
  85.       }
  86.       ,function(x)
  87.       {
  88.          this.__enabled = x;
  89.          this.invalidateStyle();
  90.       }
  91.       );
  92.       _loc7_.move = _loc9_.move;
  93.       _loc7_.setSize = _loc9_.setSize;
  94.       _loc7_.invalidateStyle = function()
  95.       {
  96.          this.invalidateFlag = true;
  97.       };
  98.       _loc7_.draw = function()
  99.       {
  100.          if(this.invalidateFlag)
  101.          {
  102.             this.invalidateFlag = false;
  103.             var _loc2_ = this._getTextFormat();
  104.             this.setTextFormat(_loc2_);
  105.             this.setNewTextFormat(_loc2_);
  106.             this.embedFonts = _loc2_.embedFonts == true;
  107.             if(this.__text != undefined)
  108.             {
  109.                if(this.text == "")
  110.                {
  111.                   this.text = this.__text;
  112.                }
  113.                delete this.__text;
  114.             }
  115.             this._visible = true;
  116.          }
  117.       };
  118.       _loc7_.setColor = function(color)
  119.       {
  120.          this.textColor = color;
  121.       };
  122.       _loc7_.getStyle = _loc5_.getStyle;
  123.       _loc7_.__getTextFormat = _loc6_.__getTextFormat;
  124.       _loc7_.setValue = function(v)
  125.       {
  126.          this.text = v;
  127.       };
  128.       _loc7_.getValue = function()
  129.       {
  130.          return this.text;
  131.       };
  132.       _loc7_.addProperty("value",function()
  133.       {
  134.          return this.getValue();
  135.       }
  136.       ,function(v)
  137.       {
  138.          this.setValue(v);
  139.       }
  140.       );
  141.       _loc7_._getTextFormat = function()
  142.       {
  143.          var _loc2_ = this.stylecache.tf;
  144.          if(_loc2_ != undefined)
  145.          {
  146.             return _loc2_;
  147.          }
  148.          _loc2_ = new TextFormat();
  149.          this.__getTextFormat(_loc2_);
  150.          this.stylecache.tf = _loc2_;
  151.          if(this.__enabled == false)
  152.          {
  153.             if(this.enabledColor == undefined)
  154.             {
  155.                var _loc4_ = this.getTextFormat();
  156.                this.enabledColor = _loc4_.color;
  157.             }
  158.             var _loc3_ = this.getStyle("disabledColor");
  159.             _loc2_.color = _loc3_;
  160.          }
  161.          else if(this.enabledColor != undefined)
  162.          {
  163.             if(_loc2_.color == undefined)
  164.             {
  165.                _loc2_.color = this.enabledColor;
  166.             }
  167.          }
  168.          return _loc2_;
  169.       };
  170.       _loc7_.getPreferredWidth = function()
  171.       {
  172.          this.draw();
  173.          return this.textWidth + 4;
  174.       };
  175.       _loc7_.getPreferredHeight = function()
  176.       {
  177.          this.draw();
  178.          return this.textHeight + 4;
  179.       };
  180.       TextFormat.prototype.getTextExtent2 = function(s)
  181.       {
  182.          var _loc3_ = _root._getTextExtent;
  183.          if(_loc3_ == undefined)
  184.          {
  185.             _root.createTextField("_getTextExtent",-2,0,0,1000,100);
  186.             _loc3_ = _root._getTextExtent;
  187.             _loc3_._visible = false;
  188.          }
  189.          _root._getTextExtent.text = s;
  190.          var _loc4_ = this.align;
  191.          this.align = "left";
  192.          _root._getTextExtent.setTextFormat(this);
  193.          this.align = _loc4_;
  194.          return {width:_loc3_.textWidth,height:_loc3_.textHeight};
  195.       };
  196.       if(_global.style == undefined)
  197.       {
  198.          _global.style = new mx.styles.CSSStyleDeclaration();
  199.          _global.cascadingStyles = true;
  200.          _global.styles = new Object();
  201.          _global.skinRegistry = new Object();
  202.          if(_global._origWidth == undefined)
  203.          {
  204.             _global.origWidth = Stage.width;
  205.             _global.origHeight = Stage.height;
  206.          }
  207.       }
  208.       var _loc4_ = _root;
  209.       while(_loc4_._parent != undefined)
  210.       {
  211.          _loc4_ = _loc4_._parent;
  212.       }
  213.       _loc4_.addProperty("width",function()
  214.       {
  215.          return Stage.width;
  216.       }
  217.       ,null);
  218.       _loc4_.addProperty("height",function()
  219.       {
  220.          return Stage.height;
  221.       }
  222.       ,null);
  223.       _global.ASSetPropFlags(_loc4_,"width",1);
  224.       _global.ASSetPropFlags(_loc4_,"height",1);
  225.       return true;
  226.    }
  227. }
  228.