ball1.addEventListener(MouseEvent.CLICK, gourl);
function gourl(e:MouseEvent):void {
var url:String = "http://www.google.co.jp";
var urlReq:URLRequest = new URLRequest(url);
navigateToURL(urlReq, "_blank");
}
ball2.addEventListener(MouseEvent.ROLL_OVER, onRollover);
ball2.addEventListener(MouseEvent.ROLL_OUT, onRollout);
function onRollover(e:MouseEvent):void {
var target_mc:MovieClip = e.target as MovieClip;
target_mc.scaleX=target_mc.scaleY=2.0;
}
function onRollout(e:MouseEvent):void {
var target_mc:MovieClip = e.target as MovieClip;
target_mc.scaleX=target_mc.scaleY=1.0;
}
ball1.speedX=3+Math.random()*5;
ball2.speedX=3+Math.random()*5;
ball3.speedX=3+Math.random()*5;
ball1.speedY=3+Math.random()*5;
ball2.speedY=3+Math.random()*5;
ball3.speedY=3+Math.random()*5;
ball1.scaleX=ball1.scaleY = 0.6+Math.random() * 0.3;
ball2.scaleX=ball2.scaleY = 0.6+Math.random() * 0.3;
ball3.scaleX=ball3.scaleY = 0.6+Math.random() * 0.3;
ball1.addEventListener(Event.ENTER_FRAME, onEnterframe);
ball2.addEventListener(Event.ENTER_FRAME, onEnterframe);
ball3.addEventListener(Event.ENTER_FRAME, onEnterframe);
function onEnterframe(e:Event):void {
var mc:MovieClip=e.target as MovieClip;
if (((mc.x-mc.width/2)<0)||((mc.x+mc.width/2)>stage.stageWidth)) {
mc.speedX*=-1;
}
0 件のコメント:
コメントを投稿