Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-18-2010, 07:37 PM   #1
Miroku_87
Senior Member
 
Miroku_87's Avatar
 
Join Date: Apr 2010
Posts: 238
Default Removing ONE SPECIFIED element from array

Hi guys, how can I make a function which does this?
ActionScript Code:
var array:Array = ["europe","america","asia","africa","oceania"] array.remove("asia"); //array now is ["europe","america","africa","oceania"]

Thanx in advance =)
Miroku_87 is offline   Reply With Quote
Old 05-18-2010, 08:24 PM   #2
neilmmm
Senior Member
 
neilmmm's Avatar
 
Join Date: Oct 2005
Location: dorset
Posts: 1,637
Default

Code:
var array:Array = ["europe", "america", "asia", "africa", "oceania"];
function remove(target) {
	for (i=0; i<array.length; i++) {
		if (target == array[i]) {
			array.splice(i, 1);
			trace(array);
		}
	}
}
remove("asia");
neilmmm is offline   Reply With Quote
Old 05-18-2010, 08:28 PM   #3
Miroku_87
Senior Member
 
Miroku_87's Avatar
 
Join Date: Apr 2010
Posts: 238
Default

Thanx a lot =)
Miroku_87 is offline   Reply With Quote
Old 05-18-2010, 08:31 PM   #4
neilmmm
Senior Member
 
neilmmm's Avatar
 
Join Date: Oct 2005
Location: dorset
Posts: 1,637
Default

welcome
neilmmm is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:17 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.