开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜