多态:
var f:IFlyable = new Bird();
f.fly();
5 简单字符串处理
var s:String = "syx";
for(var i:int=0; i<s.length; i+=1) {
trace(s.charAt(i),s.charCodeAt(i) );
}
trace(s.concat(" hellow"," world"));
trace(s.toUpperCase());
6 数组

var a1 : Array = [1,2,3];
var a2 : Array = ["a","b","c"];
var a3 : Array = new Array();
trace(a3.push("one"));1
trace(a3.push("two"));2
trace(a3.push("three"));3
trace(a3);one,two,three
var a4 : Array = new Array(3);
trace(a4.length);3
trace(a4[0]);undefined
var a5 : Array = new Array('zhangsan','lisi','wangwu');
a5.unshift('zhaoliu');
trace(a5);zhaoliu,zhangsan,lisi,wangwu
function splice(startIndex:int,deleteCount:uint,... values):Array
a5.splice(1,'sunqi','liuba');
删除1位置后0个元素(包括1),在插入...args
trace(a5);a5.splice(1,2);
trace(a5);Removes the last element from an array and returns the value of that element
a5.pop();
Removes the first element from an array and returns that element.
a5.shift();
delete a5[0]; a5[0] = 'undefined'
trace(a5[0]);undefined
Reverses(逆序) the array in place
a5.reverse();
Sorts the elements in an array. This method sorts according to
Unicode values. (ASCII is a subset of Unicode.)
a5.sort();
a5.sort(Array.CASEINSENSITIVE);
a5.sort(Array.DESCENDING | Array.CASEINSENSITIVE );
var poets:Array = new Array();
poets.push({name:"Angelou",born:"1928"});
poets.push({name:"Blake",born:"1757"});
poets.push({name:"cummings",born:"1894"});
poets.push({name:"Dante",born:"1265"});
poets.push({name:"Wang",born:"701"});
poets.sortOn("born",Array.NUMERIC);
7 异常处理
var a :Array = [1,3];
try {
throw new EOFError("error occur");
} catch (error:EOFError) {
trace(error);
} finally {
trace("finally");
}