高分求助一道flash AS3.0编程问题。
谢谢大家了。 展开
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.Sprite;
var jiaodu:Number=new Number ;
var sudu:Number=new Number ;
var yn=1;
//把五个球放入数组、显示在空容器中、再隐身
var ball_arr:Array=new Array(b1_mc,b2_mc,b3_mc,b4_mc,b5_mc);
for (var i:int =0; i<5; i++) {
ball_arr[i].visible=false;
}
//定岩含郑义时间间隔函数
var timer:Timer=new Timer(100);
timer.stop();
timer.addEventListener(TimerEvent.TIMER,run_fn);
function run_fn(ev) {
for (var i:int =0; i<5; i++) {
ball_arr[i]["va"]=ball_arr[i]["va"]+ball_arr[i]["vd"]*yn;
sudu=ball_arr[i]["va"];
var vr=ball_arr[i]["vr"];
var vx=vr*Math.sin(sudu)+200;
var vy=vr*Math.cos(sudu)+200;
ball_arr[i].x=vx;
ball_arr[i].y=vy;
}
}
creat_btn.addEventListener(MouseEvent.MOUSE_DOWN,five_fn);
function five_fn(ev) {
粗颂for (var i:int =0; i<5; i++) {
//现身吧!
老衫 ball_arr[i].visible=true;
var angle=Math.random()*360;
var vr=Math.random()*160+20;
var vx=vr*Math.sin(angle)+200;
var vy=vr*Math.cos(angle)+200;
ball_arr[i].x=vx;
ball_arr[i].y=vy;
ball_arr[i]["vd"]=Math.random()*0.3+0.01;
ball_arr[i]["vr"]=vr;
ball_arr[i]["va"]=angle;
}
yn=1;
timer.start();
}
//顺
true_btn.addEventListener(MouseEvent.MOUSE_DOWN,roa_fn);
function roa_fn(ev) {
yn=1;
}
//反
rotation_btn.addEventListener(MouseEvent.MOUSE_DOWN,roatatin_fn);
function roatatin_fn(ev) {
yn=-1;
}
//结束
stop_btn.addEventListener(MouseEvent.MOUSE_DOWN,stop_fn);
function stop_fn(ev) {
for (var i:int =0; i<5; i++) {
ball_arr[i].visible=false;
}
timer.stop();
}========================================
您的问题==我的课题 奉献知识==辉煌生命
黑龙江省 张志晨
========================================
2024-10-28 广告