I havent used pureMVC but worked with Cairngorm and havent felt too good with it. The problem I face with Cairngorm is that there is need to use observers to detect the change in the model. I mean the the view really has no idea when the model it consumes would change.
The problem here is when multiple UI components are trying to detect a change to the model, you have no idea about the order in which the views react. So cairngirm became a sure shot way of getting into trouble for me.
So I had to find other approaches. And a different approach find did I. :-) . Here is a brief description of my little MVC implementation.
- Create an interface that acts a contract between the view and the controller(handler)
Ex: -- > mx:Application implements="com.simplemvc.IsampleInterface"
3.Create a reference to the handler in the view . The handler should also hold a refernce to tghe view. Have something like
Ex:--> handler:SampleHandler id="myHandler" view="{this}" myData="{this.gridData}"
4. Call the methods in handlers/controllers when you need to .
Ex: handler.getData();
5.Have the handler call your remote Object/web service/httpservice and call back the view using the reference
Ex:view.updateCollection(data:ArrayCollection)
Checkout the source code here
Comments welcome.
6 comments:
Hey Venkat,
The examples area is blank in the blog.
Hi Brijesh,
I am able to download the zip..
May be you should disable your popup blocker..
Thanks,
Venkat
OMG! Blogger doesn tlike mxml tags it seems..
Yeah Buddy...
M facing the same issues while posting code in my blog..
Do you have idea how to put code in ur blog.. with mxml tags ofcourse.
It its a normal code it works fine. But at times I'd want the color coding format also to come.
Let me know if you come across any info on this.
dude ur pic sucks-lavanya
@Lavanya-Mind sending me yours? :D
Post a Comment