1---for(初始值;条件;递增)
for(var x:int=1;x<10;x++){
trace(x);
}
2---for(属性名 in 数组/对象)
var myarr:Array = ["alpha","beta","chi"];
for(var i:String in myarr)
{
trace(i);
}
输出的是0 1 2;
var myarr:Array = ["alpha","beta","chi"];
for(var i:String in myarr)
{
trace(i);
}
输出的是alpha,beta,chi;
var myobj:Object = {firstname:‘Jeff’,lastname:'Sma'};
for(var i:String in myobj)
{
trace("Pro:"+i+"="+myobj[i]);
}
输出的是firstname=Jeff,lastname=Sma