how to best use MVC architecture in flex 2
April 24, 2007 2:54 PM Subscribe
trying to set up MVC (model view controller) architecture for a Flex 2 project
posted by drjimmy11 to computers & internet (2 answers total) 1 user marked this as a favorite
myself and a colleague are starting a flex 2 project. we are both new to Flex, and not all that experienced in OOP.
Our question is about components: we have the overall application (the main mxml file) and then other components which are their own mxml files. One is the Controller and one is the DataModel.
From a code point of view, it seems we can only go down: ie, if we put both components in the top level app, we can give them id's and talk "down" to them, but the components cant go "up" and reference a function or variable in the main app.
So the question is, a) is there a way to go "up" and b) is it a good programming practice.
I am currently arguing that the Controller should be called in the Application, and the Data Model called inside the Controller, because the Controller needs access to the data. This way the Application can call Controller functions which access the data and return formatted data to the app. Does this make sense and, if not, how else do we architect it? We initially tried putting both components at the top (application) label, but couldn't get them to talk to each other.
hope that makes sense. thanks!