Advertisement
Guest User

simeon

a guest
Sep 28th, 2008
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*** Website.as ***/
  2.  
  3. package
  4. {
  5.     import flash.display.MovieClip;
  6.    
  7.     public class Website extends MovieClip
  8.     {
  9.         public function Website()
  10.         {
  11.             var a:Array = new Array(5);
  12.            
  13.             for(var i:Number = 0; i < 5; i++)
  14.             {
  15.                 a[i] = new Box(i * (150 + i), 20, 150, 50);
  16.                 this.addChild(a[i]);
  17.             }
  18.         }
  19.     }
  20. }
  21.  
  22. /*** Box.as ***/
  23.  
  24. package
  25. {
  26.     import caurina.transitions.Tweener;
  27.     import caurina.transitions.properties.ColorShortcuts;
  28.     import caurina.transitions.properties.FilterShortcuts;
  29.    
  30.     import flash.display.MovieClip;
  31.     import flash.events.MouseEvent;
  32.    
  33.     ColorShortcuts.init();
  34.     FilterShortcuts.init();
  35.    
  36.     public class Box extends MovieClip
  37.     {
  38.         private const bgColor:uint = 0x333333;
  39.         private const bgColor_over:uint = 0x444444;
  40.        
  41.         private var _posy_:Number = 9999;
  42.         private var _posx_:Number;
  43.         private var _w_:Number;
  44.         private var _h_:Number;
  45.        
  46.         private var _posy:Number;
  47.         private var _posx:Number;
  48.         private var _w:Number;
  49.         private var _h:Number;
  50.        
  51.         public function Box(posX:Number, posY:Number, theWidth:Number, theHeight:Number)
  52.         {
  53.             this.graphics.beginFill(bgColor);
  54.             this.graphics.drawRect(posX, posY, theWidth, theHeight);
  55.             this.graphics.endFill();
  56.             this.addEventListener(MouseEvent.MOUSE_OVER, fadeIn);
  57.             this.addEventListener(MouseEvent.MOUSE_OUT, fadeOut);
  58.         }
  59.         private function fadeIn(e:MouseEvent):void
  60.         {
  61.             if(_posy_ == 9999)
  62.             {
  63.                 _posy_ = this.y;
  64.                 _posx_ = this.x;
  65.                 _w_ = this.width;
  66.                 _h_ = this.height;
  67.             }
  68.            
  69.             _posy = _posy_ - 2;
  70.             _h = _h_ - 4;
  71.            
  72.             _posx = _posx_ + 6;
  73.             _w = _w_ + 6;
  74.            
  75.             trace("fadeIn(): tweening from " + this.x + " to " + _posx);
  76.            
  77.             Tweener.addTween(this, {x:_posx, width:_w, y:_posy, height:_h, _color:bgColor_over, _Blur_blurX:0, _Blur_blurY:0, time:0.5, transition:"easeOutSquare"});
  78.         }
  79.         private function fadeOut(e:MouseEvent):void
  80.         {
  81.             Tweener.addTween(this, {x:_posx_, width:_w_, y:_posy_, height:_h_, _color:bgColor, _Blur_blurX:0, _Blur_blurY:0, time:0.2, transition:"linear"});
  82.         }
  83.     }
  84. }
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement