Why have the step with the semicolon? You can just do this:

var foo:Array = ["a", "b", "c", ["d", "e", ["d", "e", ["d", "e", ["d",
"e"]]]], "f", ["g", ["h"]], [[], "i"], "j"];
var fooFlat:Array = foo.toString().split(",");

Potential problems with this approach:
- It does not preserve the type of the elements, converting them all to
string.
- Any element that equates to a string with a comma in it will be
evaluated as two elements. E.g, if foo is set to ["a,b", "c"], it will
flatten to a 3-element array.

So it's only useful if the atomic elements are strings, and they are
guaranteed not to include commas.

I have no idea how efficient it is, processor-wise, although I would
suspect it is rather slow.
--
T. Michael Keesey

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bernard
Visscher
Sent: Tuesday, July 25, 2006 2:05 PM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Attention Recursion & Speed Experts

I don't know if I understand this correctly, but is it making a array
flat?

Then this is the fastest way I think:

var foo : Array = ["a", "b", "c", ["d", "e",["d", "e",["d", "e",["d",
"e"]]]], "f", ["g", ["h"]], [[], "i"], "j"];
var fooString:String = foo.join(";");
fooString = fooString.split(",").join(";");
foo = fooString.split(";");

output:
a,b,c,d,e,d,e,d,e,d,e,f,g,h,,i,j
 

Bernard

> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Namens 
> Danny Kodicek
> Verzonden: dinsdag 25 juli 2006 21:51
> Aan: Flashcoders mailing list
> Onderwerp: Re: [Flashcoders] Attention Recursion & Speed Experts
> 
> >Oh, I just noticed that Mark's was fastest.  
> 
> Sorry, replied to an easlier mail before noticing the thread 
> continued...
> 
> Danny
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training 
> http://www.figleaf.com http://training.figleaf.com
> 

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to