入門AS3需要知道的一些基本語法
Click”閱讀更多”to Read
1. Timer
var myTimer:Timer = new Timer(500,10);//(時間,次數)
myTimer.addEventListener(TimerEvent.TIMER, counting);
myTimer.start();
function counting(event:TimerEvent):void {
}
2. Stage.width
var stageWidth_num:Number = new Number();
stageWidth_num = stage.stageWidth;
3. parent
var myParent = parent;
myParent.mc//mc=MovieClip
4. depth(kTop)
var topPosition:Number = numChildren - 1;
setChildIndex(mc,topPosition)
5. appendText(a.text+="b")
stage.addEventListener (KeyboardEvent.KEY_DOWN, kbPress);
function kbPress(event:KeyboardEvent):void{
var code:Number = event.keyCode;
switch (code) {
case event.keyCode = 65:
msg.appendText("a");
break;
}
}
6. mc change color
import flash.geom.ColorTransform ;
var color:ColorTransform=new ColorTransform(1,1,1,1,255,0,0,0) ;
mc.transform.colorTransform=color ;
0 意見:
張貼留言