Now the time has come for us to wire up the view to the model and controller. Refer to the following code:

<?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:
  1. Button's event handler makes a call to the Controller
  2. The Text is bound to the "result" variable in the model
And now we have our hand-rolled MVC all setup.