Flex中Array的IndexOf 的作用示例介绍(flex值为1)学会了吗

随心笔谈9个月前发布 admin
76 0

xmlns:s=”library://ns.adobe.com/flex/spark”

xmlns:mx=”library://ns.adobe.com/flex/mx”

width=”100%” height=”100%” creationComplete=”creationHandler(event)”>

import mx.events.FlexEvent;

protected function creationHandler(event:FlexEvent):void

{

var array:Array=[“桃树”,”梨树”,”松树”,”樟树”];

if(array.indexOf(“梨树”) !=-1)

{

trace(“按索引从小到大查:”+array.indexOf(“梨树”));

}

if(array.indexOf(“樟树”,3) !=-1)

{

trace(“从第三个元素开始,按索引从小到大查:”+array.indexOf(“樟树”,3));

}

}

]]>

© 版权声明

相关文章