hey cor,
i'm guessing jason's example is modern ActionScript 3.0, but if you're looking for a range of examples, here's one in ActionScript 2.0, showing how to implement a clock using mvc:

http://www.moock.org/lectures/mvc/

other than little syntactic details, the only aspect of the code that is obviously outdated is the "Observer" pattern implementation. in ActionScript 3.0, you'd use events rather than "Observer" to send updates from the model to the view(s), but the example is pretty much still applicable otherwise. it might even make an interesting study project to update it to ActionScript 3.0.

have fun!

colin


Cor wrote:
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

Reply via email to