I’m just looking for some advice on implementing an MCV design pattern for a game I’m developing in AS3.
Specifically I’m a little stuck on where I should be instantiating display objects from. I understand the model performs all the logic of a program and is unaware of any views reading from it. My problem is I need the model to be able to access certain display object so it can perform localToGlobal operations on them and their positions accordingly.
I can think of 2 ways to solve this but I’m not sure which way is better (or neither).
The first way is to pass a reference of the display object to the model (via the controller of course).
The second way is to instanctiate all view objects through the model with Factory methods, that way the model retains references to everything it creates.
I guess I’m just wondering if anyone has any suggestions or if their is any ‘official’ way to do it.