When to new your model?

http://joelhooks.com/2011/03/12/an-introduction-to-robotlegs-as3-part-2-models/

you dun need actually
public class AuthorModel extends Actor
{
private var _list:Array;

public function get list():Array
{
if(!_list)
initializeList();
return _list;
}

protected function initializeList():void
{
var twain:Author = new Author(“Twain”);
var poe:Author = new Author(“Poe”);
var plato:Author = new Author(“Plato”);
var fowler:Author = new Author(“Fowler”);

twain.quote = “Why, I have known clergymen, good men, kind-hearted, liberal, sincere” +
“, and all that, who did not know the meaning of a ‘flush.’ It is enough ” +
“to make one ashamed of one’s species.”;
fowler.quote = “Any fool can write code that a computer can understand. ” +
“Good programmers write code that humans can understand.”;
poe.quote = “Deep into that darkness peering, long I stood there, wondering, ” +
“fearing, doubting, dreaming dreams no mortal ever dared to dream before.”;
plato.quote = “All things will be produced in superior quantity and quality, and with greater ease, ” +
“when each man works at a single occupation, in accordance with his natural gifts, ” +
“and at the right moment, without meddling with anything else. “;

_list = [twain,fowler,poe,plato];
}
}

got it ?

Posted in: AS3