jason's been doing it for a lot longer than me but mine is basically the
following:

var model:Model = new Model();

var controller1:Controller = new Controller(model);
var controller2:Controller = new Controller(model);

var view1:View = new View(model, controller1);
var view2:View = new View(model, controller1);
var view3:View = new View(model, controller2);
var view4:View = new View(model, controller2);

every class will save the references passed into them as class properties.
The views delegate their actions to their controllers which update the model
which fires events to update the views. Common view types should use common
controllers to avoid duplicating functionality code from one controller to
the next.

The more traditional mvc will use singleton models and controllers and the
controllers will keep a list of registered views and update them (so the
view will call some kind of register() method on the controller) or the
views will simply listen to the controller to update themselves





On 26 March 2010 16:25, Cor <c...@chello.nl> wrote:

> WOW, thanks Jason.
> You're the best!
> This will keep me of the street for some time. :-)
>
> Thanks again, I appreciate this very much!!!
>
> Grateful regards
> Cor
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill,
> Jason
> Sent: vrijdag 26 maart 2010 17:20
> To: Flash Coders List
> Subject: RE: [Flashcoders] Events can be tedious, general thoughts on best
> practice?
>
> Hi Cor,
>
> I'm sending you a very basic MVC template I wrote offlist.  You can start
> building off that if you like.  I can't send you any actual projects I am
> working on obviously.
>
>
> Jason Merrill
>
> Bank of  America  Global Learning
> Learning & Performance Solutions
>
> Join the Bank of America Flash Platform Community  and visit our
> Instructional Technology Design Blog
> (note: these are for Bank of America employees only)
>
>
>
>
>
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor
> Sent: Friday, March 26, 2010 12:11 PM
> To: 'Flash Coders List'
> Subject: RE: [Flashcoders] Events can be tedious,general thoughts on best
> practice?
>
> Thanks Jason,
>
> I understand the theory, but have a problem creating a MVC myself.
> I don't want to use other frameworks, I want to learn to OOP in Flash and
> how to create an MVC from scratch.
> I am really looking for some simple, but completely working examples.
>
> Regards
> Cor
>
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill,
> Jason
> Sent: vrijdag 26 maart 2010 17:04
> To: Flash Coders List
> Subject: RE: [Flashcoders] Events can be tedious, general thoughts on best
> practice?
>
> In basic MVC, the controller listens to both the model and view for events.
> Since Flash doesn't have data binding like Flex has, the model might
> dispatch an event when a value changes, and the controller would then tell
> the view how to change and might send a value to it.  Also, the view might
> dispatch an event that the controller would be listening for, and the
> controller might then tell another view or the model (or both) to change.
> So the controller controls the view and the model, but the controller does
> not get controlled.
>
> In more advanced patterns and frameworks, you have things like commands
> (like in Cairngorm), façades, proxies etc. to also facilitate these
> communications.
>
>
> Jason Merrill
>
> Bank of  America  Global Learning
> Learning & Performance Solutions
>
> Join the Bank of America Flash Platform Community  and visit our
> Instructional Technology Design Blog
> (note: these are for Bank of America employees only)
>
>
>
>
>
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor
> Sent: Friday, March 26, 2010 11:41 AM
> To: 'Flash Coders List'
> Subject: RE: [Flashcoders] Events can be tedious,general thoughts on best
> practice?
>
> Thanks Jason,
> I am still investigating/trying to learn the MVC pattern and I noticed the
> same handling as far as the model aspect.
> So if you can elaborate on that too, it is highly appreciated.
>
> Kind regards,
>
> Cor
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill,
> Jason
> Sent: vrijdag 26 maart 2010 16:10
> To: Flash Coders List
> Subject: RE: [Flashcoders] Events can be tedious, general thoughts on best
> practice?
>
> I missed the beginning of this thread somehow, but FWIW, FlashDevelop
> has an Add > New Event menu option in the project pane when you right
> click on a package folder which makes creating custom events a snap.
> All you really have to do is enter the static event constants you want
> the event to have and you're done. When you select this option, it
> auto-generates a file with this in it:
>
> package events
> {
>        import flash.events.Event;
>
>        /**
>         * ...
>         * @author Jason Merrill
>         */
>        public class NewEvent extends Event
>        {
>
>                public function NewEvent(type:String,
> bubbles:Boolean=false, cancelable:Boolean=false)
>                {
>                        super(type, bubbles, cancelable);
>
>                }
>
>                public override function clone():Event
>                {
>                        return new NewEvent(type, bubbles, cancelable);
>                }
>
>                public override function toString():String
>                {
>                        return formatToString("NewEvent", "type",
> "bubbles", "cancelable", "eventPhase");
>                }
>
>        }
>
> }
>
>
> Jason Merrill
>
> Bank of  America  Global Learning
> Learning & Performance Solutions
>
> Join the Bank of America Flash Platform Community  and visit our
> Instructional Technology Design Blog
> (note: these are for Bank of America employees only)
>
>
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com
> Versie: 9.0.791 / Virusdatabase: 271.1.1/2770 - datum van uitgifte:
> 03/25/10
> 21:50:00
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com
> Versie: 9.0.791 / Virusdatabase: 271.1.1/2770 - datum van uitgifte:
> 03/25/10
> 21:50:00
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com
> Versie: 9.0.791 / Virusdatabase: 271.1.1/2770 - datum van uitgifte:
> 03/25/10
> 21:50:00
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to