View Full Version : Flash movie clip classes.

06-24-2012, 01:48 PM
I'm working on a flash project where I have a bunch of different movie clips that should all have the same behavior but the movie clips themselves are different.

I have 15 different movie clips with any 3 at a time being displayed. They should all have the same onclick event - (basically they change colour depending on which colour is selected)

In the mockup I did I had to create a separate class for each movie clip that extends a common based class (that extends movie clip) - is that really how its supposed to be done? It wouldn't let me set the same class for each of them.

Also, what is the best practice way of passing data between objects? I'm not happy with the way I'm currently doing it.

Palettes (also a movie clip with a custom class) need to know which object is currently selected and objects need to know what the currently selected palette is.

06-25-2012, 02:16 AM
I would use the same event handler for all and do a switch according the currentTarget of the fired event.
As for the data exchange, if a global variable is not enough for what you need to do, use messages to send whatever you want from a movieclip to another.