- Home
- Articles
- Best Practices
- Flex and MVC - Part I
Flex and MVC - Part I

Wiring up the View
Kapil Viren Ahuja
I still remember the day when I was so much excited to get my hands for
the very first time on a computer and I can not believe that it was 12
years ago. The journey since then has been truly wonderful.
Currently,
I am with Sapient as an Technical Architect work in J2EE tech stack.
Front-ends have been my fort always while I continue to get my head
around the services and business. My recent endeavor is in Adobe Flex
which I am very excited about.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import classes.MVCPart1.Controller;
import classes.MVCPart1.Model;
[Bindable]
private var model:Model = Model.getInstance();
private function clickHandler():void
{
var controller:Controller = new Controller();
controller.showName(personName.text);
}
]]>
</mx:Script>
<mx:TextInput id="personName" />
<mx:Text id="res" text="{model.result}" />
<mx:Button id="showHello" label="Say Hello" click="clickHandler();"/>
</mx:Application>
Note:
- Button's event handler makes a call to the Controller
- The Text is bound to the "result" variable in the model
Spread The Word
1 Response to "Flex and MVC - Part I" 
|
said this on 31 Dec 2008 10:00:57 AM CST
I like the way you're using the DataBinding to keep the UI updated. But you're missing the idea of:
"program to an interface, not an implementation" The Singleton Pattern is good, but it's not right. |


Author/Admin)