home *** CD-ROM | disk | FTP | other *** search
/ Practice Anatomy Lab / PAL.ISO / pc / PAL.swf / scripts / __Packages / com / argosy / ui / baseUI.as < prev    next >
Encoding:
Text File  |  2007-03-19  |  2.6 KB  |  103 lines

  1. class com.argosy.ui.baseUI extends MovieClip
  2. {
  3.    var __width;
  4.    var __height;
  5.    var bounding_box;
  6.    static var symbolName = "__Packages.com.argosy.ui.baseUI";
  7.    static var symbolLinked = Object.registerClass(com.argosy.ui.baseUI.symbolName,com.argosy.ui.baseUI);
  8.    function baseUI()
  9.    {
  10.       super();
  11.       this.init();
  12.    }
  13.    function setSize(nw, nh)
  14.    {
  15.       this._xscale = this._yscale = 100;
  16.       if(nw != null)
  17.       {
  18.          this.__width = nw;
  19.       }
  20.       if(nh != null)
  21.       {
  22.          this.__height = nh;
  23.       }
  24.       this.bounding_box._width = this.__width;
  25.       this.bounding_box._height = this.__height;
  26.       this.layout();
  27.    }
  28.    function get width()
  29.    {
  30.       return this.__width;
  31.    }
  32.    function set width(nw)
  33.    {
  34.       this.setSize(nw,null);
  35.    }
  36.    function get height()
  37.    {
  38.       return this.__height;
  39.    }
  40.    function set height(nh)
  41.    {
  42.       this.setSize(null,nh);
  43.    }
  44.    function init()
  45.    {
  46.       com.gskinner.events.GDispatcher.initialize(this);
  47.       this.bounding_box._visible = false;
  48.       this.setSize(this._width,this._height);
  49.       this.createChildren();
  50.    }
  51.    function createChildren()
  52.    {
  53.       this.layout();
  54.    }
  55.    function layout()
  56.    {
  57.    }
  58.    function _createTextField(tf_parent, tf_name, tf_depth, x, y, w, h, style, text)
  59.    {
  60.       var _loc1_ = tf_parent.createTextField(tf_name,tf_depth,x,y,w,h);
  61.       _loc1_.selectable = false;
  62.       _loc1_.html = true;
  63.       _loc1_.embedFonts = true;
  64.       _loc1_.styleSheet = style;
  65.       _loc1_.htmlText = "<p>" + text + "</p>";
  66.       return _loc1_;
  67.    }
  68.    function toTitleCaps(str)
  69.    {
  70.       var _loc2_ = str.toUpperCase() == str;
  71.       var _loc1_ = str.split(" ");
  72.       for(var _loc3_ in _loc1_)
  73.       {
  74.          if(_loc2_)
  75.          {
  76.             _loc1_[_loc3_] = _loc1_[_loc3_].substr(0,1).toUpperCase() + _loc1_[_loc3_].slice(1,_loc1_[_loc3_].length).toLowerCase();
  77.          }
  78.          else
  79.          {
  80.             _loc1_[_loc3_] = _loc1_[_loc3_].substr(0,1).toUpperCase() + _loc1_[_loc3_].slice(1,_loc1_[_loc3_].length);
  81.          }
  82.       }
  83.       _loc1_ = _loc1_.join(" ").split("-");
  84.       for(_loc3_ in _loc1_)
  85.       {
  86.          _loc1_[_loc3_] = _loc1_[_loc3_].substr(0,1).toUpperCase() + _loc1_[_loc3_].slice(1,_loc1_[_loc3_].length);
  87.       }
  88.       return _loc1_.join("-");
  89.    }
  90.    function trimSpaces(str)
  91.    {
  92.       if(str.charAt(0) == " ")
  93.       {
  94.          return this.trimSpaces(str.substr(1));
  95.       }
  96.       if(str.charAt(str.length - 1) == " ")
  97.       {
  98.          return this.trimSpaces(str.substring(0,str.length - 1));
  99.       }
  100.       return str;
  101.    }
  102. }
  103.