That's a pretty good use, as long as you call your variable something
more meaningful than "dictionary." :)

On 3/11/08, Patrick Matte | BLITZ <[EMAIL PROTECTED]> wrote:
> 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
>  Flashcoders@chattyfig.figleaf.com
>  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>  _______________________________________________
>  Flashcoders mailing list
>  Flashcoders@chattyfig.figleaf.com
>  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>


-- 
Cory Petosky : Lead Developer : PUNY
1618 Central Ave NE Suite 130
Minneapolis, MN 55413
Office: 612.216.3924
Mobile: 240.422.9652
Fax: 612.605.9216
http://www.punyentertainment.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to