2

Is it possible to use an arraylist in action script 3? I want to perform simple operations such as add() and remove()?

Thanks

1
  • ArrayList is in mx.collections. You can certainly use it in an AS3 project. It can be used when targeting the Flash Player or AIR. Commented Apr 26, 2011 at 14:43

2 Answers 2

10

The default array primitive in AS3 is already an array list. You can use commands such as .push(object) and .pop() to add and remove to an array without defining its initial length.

Check out the Array reference here: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Array.html

If you want to use something similar to remove, use: myArray.splice(myArray.indexOf(object), 1);

Sign up to request clarification or add additional context in comments.

3 Comments

LOL uhhh why did someone downvote this answer? I'll upvote... that's just plain stupid. You explained that there is already an array object in AS3 and explained some of the methods along with link.
Thanks for the simple yet great option. my flash doesn't show additional options when i press ".", so i have to find thing by searching on internet.
full tutorial of array is here : republicofcode.com/tutorials/flash/as3arrays
0

I gues somebody down voted the above answer because it's ambiguous. You can't push and pop to an ArrayList.

You need to addItem and getItemAt

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.