home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / Frizzle_fraz.swf / scripts / Code / LIB / _nx518.as < prev    next >
Encoding:
Text File  |  2008-09-26  |  4.0 KB  |  147 lines

  1. package Code.LIB
  2. {
  3.    import flash.display.Bitmap;
  4.    import flash.events.Event;
  5.    import flash.events.MouseEvent;
  6.    import flash.filters.DropShadowFilter;
  7.    import flash.geom.Rectangle;
  8.    
  9.    public class _nx518 extends _ja537
  10.    {
  11.       
  12.       public static const stMoveDown:int = 1;
  13.       
  14.       public static const stNoAction:int = 0;
  15.       
  16.       public static const stMoveUp:int = 2;
  17.        
  18.       
  19.       private var mount:Bitmap;
  20.       
  21.       private var label:_pw224;
  22.       
  23.       protected var hitSp:_pd424;
  24.       
  25.       private var state:int;
  26.       
  27.       private var iWidth:Number;
  28.       
  29.       private var iHeight:Number;
  30.       
  31.       public function _nx518(param1:Bitmap, param2:_pw224, param3:Boolean = true, param4:Number = -1, param5:Number = -1)
  32.       {
  33.          var _loc6_:_pd424 = null;
  34.          super();
  35.          this.iHeight = param5;
  36.          this.iWidth = param4;
  37.          if(param1)
  38.          {
  39.             this.mount = param1;
  40.             this.addChild(mount);
  41.          }
  42.          (_loc6_ = new _pd424()).graphics.beginFill(16711680,0);
  43.          if(param5 > 0)
  44.          {
  45.             _loc6_.graphics.drawRect(0,0,param4 * _bm350._tc204,param5 * _bm350._tc204);
  46.          }
  47.          else
  48.          {
  49.             _loc6_.graphics.drawRect(0,0,this.mount.width,this.mount.height);
  50.          }
  51.          _loc6_.graphics.endFill();
  52.          this.hitSp = _loc6_;
  53.          if(param2)
  54.          {
  55.             this.label = param2;
  56.             this._pn173 = this.label.iText.text;
  57.             this.addChild(label);
  58.          }
  59.          this.addChild(_loc6_);
  60.          hitArea = _loc6_;
  61.          if(param3)
  62.          {
  63.             this.filters = [new DropShadowFilter(18 * _bm350._tc204,45,0,0.8,30 * _bm350._tc204,30 * _bm350._tc204,0.4 * _bm350._tc204)];
  64.          }
  65.          this.alpha = 1;
  66.          this.buttonMode = true;
  67.       }
  68.       
  69.       public function get _ol346() : _pd424
  70.       {
  71.          return this.hitSp;
  72.       }
  73.       
  74.       public function set _pn173(param1:String) : void
  75.       {
  76.          var _loc2_:Rectangle = null;
  77.          var _loc3_:Rectangle = null;
  78.          var _loc4_:Number = NaN;
  79.          this.label.Text = param1;
  80.          _loc2_ = this.label.iText.getCharBoundaries(0);
  81.          _loc3_ = this.label.iText.getCharBoundaries(label.iText.text.length - 1);
  82.          if(this.iWidth < 0)
  83.          {
  84.             this.label.x = (this.mount.width - _loc3_.right) / 2;
  85.             this.label.y = (this.mount.height - _loc2_.height) / 2;
  86.          }
  87.          else
  88.          {
  89.             _loc4_ = iWidth * _bm350._tc204;
  90.             this.label.x = (iWidth * _bm350._tc204 - label.width * _bm350._tc204) / 2 + 4;
  91.             this.label.y = 0;
  92.          }
  93.       }
  94.       
  95.       override public function _ry461(param1:MouseEvent) : void
  96.       {
  97.          super._ry461(param1);
  98.          this.alpha = 0.85;
  99.       }
  100.       
  101.       override public function _wy541(param1:MouseEvent) : void
  102.       {
  103.          this.State = stMoveDown;
  104.       }
  105.       
  106.       override public function onEnterFrame(param1:Event) : void
  107.       {
  108.          super.onEnterFrame(param1);
  109.          switch(state)
  110.          {
  111.             case stNoAction:
  112.                break;
  113.             case stMoveDown:
  114.                this.scaleX = this.scaleY = this.scaleY - 0.055;
  115.                if(this.scaleY < 0.9)
  116.                {
  117.                   this.State = stMoveUp;
  118.                }
  119.                break;
  120.             case stMoveUp:
  121.                this.scaleX = this.scaleY = this.scaleY + 0.025;
  122.                if(this.scaleX >= 1)
  123.                {
  124.                   this.State = stNoAction;
  125.                }
  126.          }
  127.       }
  128.       
  129.       private function set State(param1:int) : void
  130.       {
  131.          this.state = param1;
  132.          switch(state)
  133.          {
  134.             case stNoAction:
  135.                this.scaleX = 1;
  136.                this.scaleY = 1;
  137.          }
  138.       }
  139.       
  140.       override public function _im316(param1:MouseEvent) : void
  141.       {
  142.          super._ry461(param1);
  143.          this.alpha = 1;
  144.       }
  145.    }
  146. }
  147.