OOP 101 advice (please)
Hi guys
If I create a class (scroller class), and want that class to be accessed by lots of other classes, so that if one class adds a movieclip to the scroller, the previous movieclip in there (possibly from another class), is removed, how do you make it so that the scroller class is affected by all the other classes?
Do you have to
- instantiate the scroller class in your Document class
- inject it's instance into the constructors of all the classes that need access to that scroller
?
or
- create a global model to inject into all the classes, including the scroller, and populate a setter with the movieclip that you want to scroll, and have the scroller get that clip using the getter?
Because if I simply set up a var scroller:Scroller = new Scroller(); in each class, they will all have thier own exclusive scrollers, right? Which I don't want - I just want one that all the classes can affect.
Cheers guys.
