For this article, we will try and do the most simple thing "Hello World"

In the following example, we have accepted an input from the user and then said Hello to the user.

[AS]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>
<![CDATA[
import mx.controls.Alert;

// Business Logic
private function clickHandler():void
{
// Model
result.text += personName.text;
}
]]>
</mx:Script>

// View
<mx:TextInput id="personName" />

<mx:Text id="result" text="" />

<mx:Button id="showHello" label="Say Hello" click="clickHandler();"/>
</mx:Application>
[/AS]

What you will notice that in the same file, we have added all the 3 components. The MXML lines hold the view, while the click handles the business logic (in our case it is suffixing the name of the user and saying back hello) and the model that holds the data which is the user name.

You may be thinking why do we need to complicate things? For this example, things may look simple, but as your code starts to grow you will find this pattern very useful.