menu
import As.*;
import flash.filters.DropShadowFilter;
import flash.display.MovieClip;
import flash.utils.*;
/**
* Copyright muu ( http://wonderfl.net/user/muu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2vXZ
*/
package{
import flash.display.Sprite;
import flash.text.TextField;
//import As.*;
//import flash.filters.DropShadowFilter;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.*;
//import flash.display.MovieClip;
import flash.utils.setInterval;
import flash.utils.Timer;
import flash.events.TimerEvent;
//import flash.utils.*;
import flash.geom.Point;
public class Main extends Sprite {
public function Main() {
var mm:Array = new Array();
for(var i:int = 0 ; i < 5 ; i++){
var mc:Sprite = new Sprite();
mm[i] = mc;
addChild(mm[i]);
mm[i].x = 100 + i*70
mm[i].y = 200;
mm[i].graphics.beginFill(0xaaaaaa);
mm[i].graphics.drawCircle (0, 0, 30);
mm[i].graphics.endFill();
mm[i].addEventListener(MouseEvent.MOUSE_OVER,m_over);
mm[i].addEventListener(MouseEvent.MOUSE_OUT,m_out);
}
function m_over(event:Event):void{
zoomMC(event.target , 1.5);
}
function m_out(event:Event):void{
zoomMC(event.target , 1);
}
//ズーム関数 揺れながらサイズ変更
function zoomMC( mc:Sprite , scl:Number ):void{
//mc.removeEventListener(Event.ENTER_FRAME,arguments.callee); //重複するエンターフレームを削除
var rot:int = 0;//速度
var ts:Number = scl; // 目標サイズ
var bs:Number = mc.scaleX; // 初期サイズ
var yureX:Number = 0; // 揺れ幅X
var yure:Number = 20; // 弾みぐあい
var dx:Number; //
addEventListener(Event.ENTER_FRAME,function():void{
rot += yure; // 揺れの速度を設定
yureX = (ts - bs);
dx = (scl - Math.cos( rot * Math.PI / 180) * yureX);
mc.scaleX = mc.scaleY = dx;
if(ts > 0.05 ){ //揺れ幅の減算
ts -= ts/10;
}else{
ts = 0;
}
if (bs > 0.05 ){ //目標サイズまでの差を減算
bs -= bs/10;
}else{
bs = 0;
}
if ((ts + bs) == 0){
mc.removeEventListener(Event.ENTER_FRAME,arguments.callee);
}
});
}
}
}
}