The model is responsible for holding the business data. In our case we would be creating a singleton class so that the data can be persisted across calls.


package classes.MVCPart1
{
    [Bindable]
    public class Model
    {
        private static var _model:Model;
       
        public static function getInstance():Model
        {
            if(_model == null)
            {
                _model = new Model();
            }
           
            return _model;
        }
       
        public function Model()
        {
            _model = this;
        }
       
        public var result:String = "Hello ";
    }
}

Some key things to note:
  1. The class has been marked as [Bindable], so that any changed to any of the members should update the view.
  2. The variable "result" holds the data and will be responsible for updating the view