A typical usage is to piggyback data on objects in a list.
Say you have a list of specific objects, eg. Car objects.
Now you want to add a property driver without changing the Car class.
By using a dictionary you can reference the driver by means of the car
instance.
var porsche : Car = new Car("Porsche");
var bmw : Car = new Car("BMW");
var bokel : Driver = new Driver("bokel");
var maciej : Driver = new Driver("maciej");
var drivers : Dictionary = new Dictionary();
drivers[ porsche ] = bokel;
drivers[ bmw ] = maciej;
var winningCar : Car = getWinningCar();
var winningDriver : Driver = drivers[ winningCar ];
Cheers
Ralf
On 11/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> On 11/28/07, jason vancleave <[EMAIL PROTECTED]> wrote:
> > Example is Particles75.fla in the above link
> >
> > --- In [email protected], "jason vancleave" <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > best example I have seen was the use of them in a particle system. you
> > > can see the examples and source here
> > >
> > > http://www.sebleedelisle.com/?p=126
> > >
> > >
> >
> http://sebleedelisle.com/wp-content/uploads/2007/09/sebleedelisle-as3particles.zip
> > >
> > >
> > > --- In [email protected], Sheriff <sherif626@> wrote:
> > > >
> > > > Does anyone have a real world example on when to use the Dictionary
> > > Class, I don't get what purpose it serves other than using an object
> > > as a key rather than a string. When would you use something like it?
> > > >
> > > >
> > > >
> > >
> >
> ____________________________________________________________________________________
> > > > Be a better pen pal.
> > > > Text or chat with friends inside Yahoo! Mail. See how.
> > > http://overview.mail.yahoo.com/
> > > >
> > >
> >
> >
> >
>
>
> --
> Ralf Bokelberg <[EMAIL PROTECTED]>
> Flex & Flash Consultant based in Cologne/Germany
>
--
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany