The best use for them is to be able to find something you've stored by its key - as opposed to having to loop through an entire array to find it. Pretty damn handy, but sorting them can be complicated.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Matte | BLITZ Sent: Wednesday, 12 March 2008 8:42 a.m. To: Flash Coders List Subject: RE: [Flashcoders] dictionary vs array Thanks Steven, I never really understood what a dictionary was myself, so dictionary would be useful for something like this ? dictionary = new Dictionary(); button1 = new Button() dictionary[button1] = "http://www.google.com"; button2 = new Button() dictionary[button2] = "http://www.yahoo.com"; function onButtonClick(event:MouseEvent){ trace(dictionary[event.target]); } BLITZ | Patrick Matte - 310-551-0200 x214 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks Sent: Tuesday, March 11, 2008 12:14 PM To: Flash Coders List Subject: Re: [Flashcoders] dictionary vs array An Array is a linear collection. A Hash is a random access collection (lookup table) of name-value pairs. Dictionary is a fancy Hash that can take an Object as a key, instead of a String, and uses strict (===) equality for its lookups. hash = new Object(); hash.foo = "bar"; array = new Array(); array.push("hello"); array.push("world"); dictionary = new Dictionary(); dictionary[hash] = array; trace(hash.foo); -- bar trace(array) -- hello, world trace(dictionary[hash]); -- hello, world _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Scanned by Bizo Email Filter _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

