定義:
          var tempArr:Array = new Array();
          定義同時賦初值:
          var company:Array = new Array("IBM""APPLE""SUN","ADOBE");
          push:
          //將“I”放入tempArr中,tempArr中內容為Enya
          tempArr.push("Enya ");
          unshift:
          //將tempArr中“0”位置賦值為“I ”,tempArr中原有元素往后移,tempArr中內容為I Enya
          tempArr.unshift("I ");
          splice:
          //將index為“1”的元素用“like”替換,原元素不刪除(“0”),tempArr中內容為I like Enya
          tempArr.splice(10"like");
          //將tempArr中index為“2”以后的元素以"張懸","王菲","燕姿"填充,并將原數組中index為“2”的元素刪除(“1”),tempArr中的內容為:I like 張懸 王菲 燕姿
          tempArr.splice(2,1"張懸","王菲","燕姿");
          //若將該方法的參數改為
          tempArr.splice(2,0"張懸","王菲","燕姿");
          //結果為I like 張懸 王菲 燕姿 Enya
          pop:
          //彈出index最大的那個元素,company中內容為IBM,APPLE,SUN
          company.pop();
          shift:
          //彈出index為“0”的元素,company中內容為APPLE,SUN
          company.shift();
          關于數組排序:
          var nums:Array = new Array(2,0,5);
          //按照數字降序排列 nums變為5,2,0
          nums.sort(Array.NUMERIC | Array.DESCENDING);
          按照某個字段排序:
          //Array.NUMERIC默認為升序
          var students:Array = new Array(  );
                          students.push({name: 
          "Jake", age:20});
                          students.push({name: 
          "Tom", age:22});
                          students.push({name: 
          "Will", age:17});
                          
                          students.sortOn(
          "age",Array.NUMERIC);
          此外,數組還可作為List的數據源:
          list1.dataProvider=company



          posted on 2010-02-12 15:55 Ying-er 閱讀(733) 評論(0)  編輯  收藏 所屬分類: Flex3.0
          主站蜘蛛池模板: 屏边| 抚远县| 三台县| 泽州县| 额尔古纳市| 特克斯县| 左贡县| 襄垣县| 安溪县| 西畴县| 九寨沟县| 平安县| 抚松县| 尤溪县| 崇仁县| 霍邱县| 龙泉市| 五常市| 宜都市| 汉川市| 繁峙县| 开封县| 五华县| 瓦房店市| 长阳| 平凉市| 会宁县| 潮安县| 庆安县| 丰顺县| 和林格尔县| 牡丹江市| 博乐市| 广德县| 沅江市| 康定县| 伊宁县| 阿瓦提县| 沽源县| 宁蒗| 无锡市|