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

  1. class com.argosy.ui.LoadBar extends com.argosy.ui.baseUI
  2. {
  3.    var tf;
  4.    var load_percent;
  5.    var normal_style;
  6.    var bg;
  7.    var bar;
  8.    var fillbar;
  9.    var drop_shadow;
  10.    var bevel_filter;
  11.    function LoadBar()
  12.    {
  13.       super();
  14.    }
  15.    function set text(str)
  16.    {
  17.       this.tf.htmlText = "<p><loader>" + str + "</loader></p>";
  18.    }
  19.    function get text()
  20.    {
  21.       return this.tf.text;
  22.    }
  23.    function set percent(p)
  24.    {
  25.       this.load_percent = p;
  26.       if(this.load_percent >= 1)
  27.       {
  28.          this._alpha = 100;
  29.          this._visible = false;
  30.       }
  31.       else
  32.       {
  33.          this._alpha = 100;
  34.          this._visible = true;
  35.          this.drawBar();
  36.       }
  37.    }
  38.    function get percent()
  39.    {
  40.       return this.load_percent;
  41.    }
  42.    function init()
  43.    {
  44.       super.init();
  45.       this.setSize(300,100);
  46.       this._visible = false;
  47.    }
  48.    function createChildren()
  49.    {
  50.       this.normal_style = new TextField.StyleSheet();
  51.       this.normal_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#000000",textAlign:"left",textDecoration:"none",kerning:"true",letterSpacing:"0"});
  52.       this.normal_style.setStyle("loader",{fontFamily:"Frutiger Bold",fontSize:"14",color:"#438CB8"});
  53.       this.bg = this.createEmptyMovieClip("bg",1);
  54.       this.bar = this.createEmptyMovieClip("bar",2);
  55.       this.fillbar = this.createEmptyMovieClip("fillbar",4);
  56.       this.tf = this._createTextField(this,"tf",100,0,0,100,20,this.normal_style,"");
  57.       this.drop_shadow = new flash.filters.DropShadowFilter(5,45,0,0.8,10,10,1,3);
  58.       this.bevel_filter = new flash.filters.BevelFilter(5,45,16777215,0.8,0,0.8,20,20,1,3,"inner",false);
  59.       this.bg.filters = [this.drop_shadow];
  60.       this.fillbar.filters = [this.bevel_filter];
  61.    }
  62.    function drawBar()
  63.    {
  64.       var _loc2_ = this.width / 10;
  65.       var _loc3_ = this.width - 2 * _loc2_;
  66.       this.bar.clear();
  67.       this.bar.lineStyle(2,16777215,50);
  68.       this.bar.beginFill(16777215,20);
  69.       this.bar.moveTo(_loc2_,0);
  70.       this.bar.lineTo(_loc2_ + _loc3_,0);
  71.       this.bar.lineTo(_loc2_ + _loc3_,20);
  72.       this.bar.lineTo(_loc2_,20);
  73.       this.bar.lineTo(_loc2_,0);
  74.       this.bar.endFill();
  75.       var _loc4_ = new flash.geom.Matrix();
  76.       _loc4_.createGradientBox(_loc3_,20,1.5707963267948966,0,0);
  77.       this.fillbar.clear();
  78.       this.fillbar.lineStyle(2,4426936,50);
  79.       this.fillbar.beginGradientFill("linear",[14409183,4426936],[100,100],[0,255],_loc4_,"pad");
  80.       this.fillbar.moveTo(_loc2_,0);
  81.       this.fillbar.lineTo(_loc2_ + _loc3_ * this.load_percent,0);
  82.       this.fillbar.lineTo(_loc2_ + _loc3_ * this.load_percent,20);
  83.       this.fillbar.lineTo(_loc2_,20);
  84.       this.fillbar.lineTo(_loc2_,0);
  85.       this.fillbar.endFill();
  86.    }
  87.    function layout()
  88.    {
  89.       var _loc2_ = this.width / 10;
  90.       var _loc4_ = this.width - 2 * _loc2_;
  91.       this.bg.clear();
  92.       var _loc3_ = new flash.geom.Matrix();
  93.       _loc3_.createGradientBox(this.width,this.height,1.5707963267948966,0,0);
  94.       this.bg.lineStyle(2,4426936,100);
  95.       this.bg.beginGradientFill("linear",[14409183,10856103],[100,100],[0,255],_loc3_,"pad");
  96.       this.bg.lineTo(this.width,0);
  97.       this.bg.lineTo(this.width,this.height);
  98.       this.bg.lineTo(0,this.height);
  99.       this.bg.lineTo(0,0);
  100.       this.bg.endFill();
  101.       this.tf._x = _loc2_;
  102.       this.tf._y = 10;
  103.       this.tf._width = _loc4_;
  104.       this.bar._y = this.tf._y + this.tf._height + 10;
  105.       this.fillbar._y = this.bar._y;
  106.       this.drawBar();
  107.    }
  108. }
  109.