>>Is there an easy/quick way to find out if an item is in an array?
No built in methods I know of. But quick and easy, is just to loop.
Something like:
public function findStringItem(theArray:Array,
identifier:String):Number{
var i:Number = theArray.length
while (--i -(-1)) {
if(theArray[i] == identifier){
return i;
}
}
}
Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael
>>Sent: Monday, September 18, 2006 4:39 PM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] Find item in array
>>
>>Hi list...
>>
>>Is there an easy/quick way to find out if an item is in an array? For
>>instance:
>>Var a:Array = ["a","b","c","d"];
>>Var y:Number = a["b"];
>>//y would be the position in the array of "b" or undefined if it's not
>>in the array/
>>
>>I'm looking for the equivalent of Director's getOne() function.
>>
>>Thanks,
>>- Michael M.
>>
>>_______________________________________________
>>[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