Flex Mobile remove delete element value from Array

Hi Guys,

I thought I should share this one with you.

I’ve been using ArrayCollection since I started to develop Mobile Apps in Flex.

There are some moments when you end up using Array for a weird reason.

And when you end up using an array you think Oh well! how to remove element from an Array.

Below are few things that I would like you to show

First up removing an Element

Say you have an Array as shown below

[geshi lang=”actionscript” nums=”1″ target=”_self” ]

 

Lets remove value3 from the above Array

[geshi lang=”actionscript” nums=”1″ target=”_self” ]

 

Lets remove all Elements that appear after value2

[geshi lang=”actionscript” nums=”1″ target=”_self” ]

 

Lets now add value3 again after value1

[geshi lang=”actionscript” nums=”1″ target=”_self” ]

 

If you would like to remove all Array Elements then you can use Splice function again on Array like this

[geshi lang=”actionscript” nums=”1″ target=”_self” ]

 

Now that you have seen above you can write your own RemoveElementAt function that will work as per your requirement. Below is a basic function to achieve RemoveElementAt

[geshi lang=”actionscript” nums=”1″ target=”_self” ]

 

I Hope this helps

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.