Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*** Website.as ***/
- package
- {
- import flash.display.MovieClip;
- public class Website extends MovieClip
- {
- public function Website()
- {
- var a:Array = new Array(5);
- for(var i:Number = 0; i < 5; i++)
- {
- a[i] = new Box(i * (150 + i), 20, 150, 50);
- this.addChild(a[i]);
- }
- }
- }
- }
- /*** Box.as ***/
- package
- {
- import caurina.transitions.Tweener;
- import caurina.transitions.properties.ColorShortcuts;
- import caurina.transitions.properties.FilterShortcuts;
- import flash.display.MovieClip;
- import flash.events.MouseEvent;
- ColorShortcuts.init();
- FilterShortcuts.init();
- public class Box extends MovieClip
- {
- private const bgColor:uint = 0x333333;
- private const bgColor_over:uint = 0x444444;
- private var _posy_:Number = 9999;
- private var _posx_:Number;
- private var _w_:Number;
- private var _h_:Number;
- private var _posy:Number;
- private var _posx:Number;
- private var _w:Number;
- private var _h:Number;
- public function Box(posX:Number, posY:Number, theWidth:Number, theHeight:Number)
- {
- this.graphics.beginFill(bgColor);
- this.graphics.drawRect(posX, posY, theWidth, theHeight);
- this.graphics.endFill();
- this.addEventListener(MouseEvent.MOUSE_OVER, fadeIn);
- this.addEventListener(MouseEvent.MOUSE_OUT, fadeOut);
- }
- private function fadeIn(e:MouseEvent):void
- {
- if(_posy_ == 9999)
- {
- _posy_ = this.y;
- _posx_ = this.x;
- _w_ = this.width;
- _h_ = this.height;
- }
- _posy = _posy_ - 2;
- _h = _h_ - 4;
- _posx = _posx_ + 6;
- _w = _w_ + 6;
- trace("fadeIn(): tweening from " + this.x + " to " + _posx);
- 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"});
- }
- private function fadeOut(e:MouseEvent):void
- {
- Tweener.addTween(this, {x:_posx_, width:_w_, y:_posy_, height:_h_, _color:bgColor, _Blur_blurX:0, _Blur_blurY:0, time:0.2, transition:"linear"});
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement