my info in last mail bight be short-sightened if you refered to a function in the classobject itself with the second "this"

this.Model.addEventListener("PagesUpdated",this);
Giles Roadnight wrote:
Hi All

I am building my first MVC (Model View Controller) and have a question about
how I should set it up.

I have a load of classes: BookView, ControlView (both views), Controller and
PAModel.

Controller holds all the other classes and sets them all up. Both views have
a function - setModel:

   public function setModel(newModel:PAModel):Void
   {
       this.Model = newModel;
       this.Model.addEventListener("PagesUpdated",this);
       this.Model.addEventListener("currentPageUpdate",this);
   }

that sets the model (obviously) and sets up event listeners.

If I try to fire this function in the controller constructor it doesn't fire
- presumably the classes haven't woken up yet so I am firing it from a
function that fires when XML has loaded. This doesn't seem like the best way
of doing it though.

What is the best way round this? I have tried firing a onInit function from the views when they are ready but this doesn't seem to work. I assume it's because the addEventListener function doesn't work when the controller tries
to register as a listener.

Thanks for the help.
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to