I read a lot about the Model View Controller Pattern, but none of the documents explained in enough detail. And I’m still a little confused.
Basically all they did was define “The Model,” “The View,” and “The Controller.” Some had examples but they were very obscure and pointless. So I’m still unsure.
So far the best implementation of the MVC that I can come up with is to instantiate all three parts in the main document class like this:
var model:Model = new Model()
var view:View = new View(model)
var controller:Controller = new Controller(view)
then having a getter property inside the view that allows the controller to reteive the Model.
as in (inside the controller class);
// Assume that the view is received through the constructor of the Controller class as “_view:View”
Now I would access teh model of the View in he contructor of the Controller.
This would give the controller contact with the Model of the View.
My idea so far is that the Model is like a bridge in between the View and Controller, that it’s always changing.
Am I getting this right?
It would be nice if someone could give me a proper example of how I should do it.
Thanks,