Flex 4 Best Practice when using RemoteObject and multiple components
I was wondering what is considered to be a best practice when I have multiple components and use RemoteObject for AMF communication with a PHP backend.
Have the RemoteObject in the Main.mxml file with all the methods declared here (with handlers and all) and have all components call functions from the parentApplication, thus having a centralized result and fault handling, b开发者_JAVA技巧ut making reusiability more difficult.
Have a RemoteObject in each component with only the methods (and handlers) relevant to that component, thus making it easy to have clean, reusable components.
Maybe you should think about using a framework (e.g. mate). IMHO it's better to have all services in one place, so I would tend to Nr. 1 but If you have the possibility to use a framework, you should do so. (In mate it's a best practice to have one MXML with all RemoteObjects in it)
精彩评论