开发者

How can i get the number of the place in an array (AS3)?

开发者 https://www.devze.com 2023-03-18 19:19 出处:网络
if I have an array like this: var myArra开发者_开发问答y:Array = [\"apple\",\"orange\",\"strawberry\"];

if I have an array like this:

var myArra开发者_开发问答y:Array = ["apple","orange","strawberry"];

then I want to get the order number of the orange, which is 1, out. Is there any way to do that?


If you want the index of "orange" you could do this:

trace(myArray.indexOf("orange")); // returns 1


If you want to get a hold of data in a few different ways it might be worth using a dictionary object.

http://gskinner.com/blog/archives/2006/07/as3_dictionary_.html


Refer the following link, then will know about all feature of arrays.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Array.html

0

精彩评论

暂无评论...
验证码 换一张
取 消