首页 > 代码库 > AS3实用技巧

AS3实用技巧

1、载入类Loader

var loader1:Loader=new Loader();
var url1:URLRequest=new URLRequest("src/文件名");

loader1.load(url1);

loader1.x=200;
loader1.y=0;
addChild(loader1);

loader1.unload();

2、按钮单击事件

anNiu1.addEventListener(MouseEvent.CLICK,anNiu1_Hd);
function anNiu1_Hd(e:MouseEvent):void

3、计时器Timer

var timer1:Timer=new Timer(0.0001);//每××毫秒执行一次
timer1.addEventListener(TimerEvent.TIMER,timer1_Hd);

function timer1_Hd(e:TimerEvent):void

timer1.start;

timer1.stop;

4、循环间隔

var jianGe1=setInterval(hanShu1,10);//每10毫秒执行一次

function hanShu1():void

clearInterval(jianGe1);

AS3实用技巧