In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: forked from: マウスイベント

Get Adobe Flash player
by fuusuke 09 Feb 2010
    Embed
/**
 * Copyright fuusuke ( http://wonderfl.net/user/fuusuke )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tHOQ
 */

// forked from fuusuke's forked from: マウスイベント
		// forked from Itikara's マウスイベント
package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import flash.geom.*;

    [SWF(width="500", height="500", backgroundColor="0x000000")]
	public class Test extends Sprite {
		public var tw:Tween;
		public function Test() {
			for (var j:uint=0; j < 5; j++) {
				for (var i:uint=0; i < 5; i++) {
					var sp:Sprite = new Sprite();
					sp.graphics.beginFill(0xfedfef);
					sp.graphics.drawRect(0, 0, 50, 50);
					sp.graphics.endFill();
					sp.x = 25+i*100;
					sp.y = 25+j*100;
					sp.addEventListener(MouseEvent.ROLL_OVER, ov);
					sp.addEventListener(MouseEvent.ROLL_OUT, ou);
					sp.buttonMode = true;
					addChild(sp);
				}
			}
        }

        private function ov(e:MouseEvent):void
        {
        		var sp:Sprite = e.target as Sprite;
        		sp.graphics.beginFill(0xff0000);
        		sp.graphics.drawRect(0, 0, 50, 50);
        		tw = new Tween(sp, "scaleX", Regular.easeInOut, 1, 1.5, 1, true);
        		tw = new Tween(sp, "scaleY", Regular.easeInOut, 1, 1.5, 1, true);
        		tw = new Tween(sp, "x", Regular.easeInOut, sp.x, sp.x-10, 1, true);
        		tw = new Tween(sp, "y", Regular.easeInOut, sp.y, sp.y-10, 1, true);
        		
        	}
        	
        	private function ou(e:MouseEvent):void
        	{
        		var sp:Sprite = e.target as Sprite;
        		sp.graphics.beginFill(0xffcf00);
        		sp.graphics.drawRect(0, 0, 50, 50);
        		tw = new Tween(sp, "scaleX", Regular.easeInOut, 1.5, 1, 3, true);
        		tw = new Tween(sp, "scaleY", Regular.easeInOut, 1.5, 1, 3, true);
        		tw = new Tween(sp, "x", Regular.easeInOut, sp.x, sp.x+10, 3, true);
        		tw = new Tween(sp, "y", Regular.easeInOut, sp.y, sp.y+10, 3, true);
        	}
    }
}