um, Ross gave it i think dude.

i didn't give any code examples :)

maybe you missed the smiley after i said "if you don't like it", perhaps
shoudl have been a ;). what problems do you have using assets mad ein the
IDE with mvc?

On 16 February 2012 12:21, Paul Andrews <p...@ipauland.com> wrote:

> On 16/02/2012 11:11, Paul Andrews wrote:
>
>> On 16/02/2012 10:54, tom rhodes wrote:
>>
>>> traditional vanilla MVC tends to use composition like the example given,
>>> check out robotlegs if you don't like it :) then you inject dependencies
>>> instead of passing them around and everything gets a bit more loosely
>>> coupled...
>>>
>>
>> It's not a question of not liking it - your example is perfect for a
>> coded-only solution, slightly less practical when working in a mixed-mode
>> with the Flash IDE being involved in view instantiation.
>>
>
> I should say "Tom's example"..
>
>
>
>>
>>> On 16 February 2012 11:46, Paul Andrews<p...@ipauland.com>  wrote:
>>>
>>>  Excellent job.
>>>>
>>>> I have one small point, on a practical level.
>>>>
>>>> For the views, in particular, I don't usually pass arguments to the
>>>> constructor. It's not such a big deal for code-only examples, but in my
>>>> flash world I mix my components between stuff created dynamically and
>>>> things created in the IDE - sometimes I build components as assemblies
>>>> on
>>>> the stage using the IDE. The point is that passing arguments to the
>>>> constructor then becomes an issue for a view.
>>>>
>>>> Might I suggest an init() function to pass in Model and Controller?
>>>>
>>>> Paul
>>>>
>>>>
>>>>
>>>>
>>>> On 16/02/2012 07:59, Ross Sclafani wrote:
>>>>
>>>>  From: Ross Sclafani<ross.sclafani@gmail.****com<
>>>>> ross.sclaf...@gmail.com>>
>>>>> Date: February 16, 2012 2:39:34 AM EST
>>>>> To: Cor<c...@chello.nl>
>>>>> Cc: Flash Coders 
>>>>> List<flashcoders@chattyfig.**f**igleaf.com<http://figleaf.com>
>>>>> <flashcoders@**chattyfig.figleaf.com<flashcoders@chattyfig.figleaf.com>
>>>>> >>,
>>>>> flashcoder...@googlegroups.com
>>>>> Subject: Re: MVC
>>>>>
>>>>> feel free to hit me up any time ill try to have time to respong
>>>>>
>>>>> none the less, this should get you started:
>>>>>
>>>>> /*
>>>>>  * Model.as
>>>>>  *
>>>>>  * mvc.Model;
>>>>>  */
>>>>> package mvc {
>>>>>        import flash.events.EventDispatcher;
>>>>>        import flash.events.Event;
>>>>>        class Model extends EventDispatcher{
>>>>>                private var _count:int = 0;
>>>>>                public function get count():int{
>>>>>                        return _count;
>>>>>                }
>>>>>                public function set count(value:int):void{
>>>>>                        this._count= value;
>>>>>                        update();
>>>>>                }
>>>>>                public function Model(){
>>>>>                        super()
>>>>>                }
>>>>>                private function update():void{
>>>>>                        this.dispatchEvent(new Event(Event.CHANGE));
>>>>>                }
>>>>>        }
>>>>> }
>>>>>
>>>>>
>>>>> /*
>>>>>  * Controller.as
>>>>>  *
>>>>>  * mvc.Controller;
>>>>>  */
>>>>> package mvc {
>>>>>        public  class Controller {
>>>>>                private var model:Model;
>>>>>                public function Controller(model:Model){
>>>>>                        super()
>>>>>                        this.model = model;
>>>>>                }
>>>>>                public function countUp():void{
>>>>>                        this.model.count++;
>>>>>                }
>>>>>        }
>>>>> }
>>>>>
>>>>> /*
>>>>>  * View.as
>>>>>  *
>>>>>  * mvc.View;
>>>>>  */
>>>>> package mvc {
>>>>>        import flash.text.TextField;
>>>>>        import flash.events.Event;
>>>>>        import flash.display.Sprite;
>>>>>        public  class View extends Sprite(){
>>>>>                private var model:Model;
>>>>>                private var controller Controller;
>>>>>                private var textField:TextField = new TextField();
>>>>>                public function View(model:Model,
>>>>> controller:Controller){
>>>>>                        model.addEventListener(Event.****CHANGE,
>>>>> this.model_changeHandler);
>>>>>                        super()
>>>>>                        this.model = model;
>>>>>                        this.controller = controller;
>>>>>                        this.addChild(this.textField);
>>>>>                        this.stage.addEventListener(****
>>>>> MouseEvent.CLICK,
>>>>> this.stage_clickHandler)
>>>>>
>>>>>                }
>>>>>                private function stage_clickHandler(event:**
>>>>> MouseEvent):void{
>>>>>                        this.controller.countUp();
>>>>>                }
>>>>>                private function model_changeHandler(event:****
>>>>> Event):void{
>>>>>                        this.textField.text = this.model.count
>>>>>                }
>>>>>        }
>>>>> }
>>>>> /*
>>>>>  * App.as
>>>>>  *
>>>>>  * MVC screen click counter.
>>>>>  */
>>>>> package{
>>>>>        import mvc.Model;
>>>>>        import mvc. View;
>>>>>        import mvc.Controller;
>>>>>        public class App{
>>>>>                private var model:Model = new Model();
>>>>>                private var controller:Controller = new
>>>>> Controller(this.model);
>>>>>                private var view:View = new View(model, controller);
>>>>>                public function App(){
>>>>>                        this.addChild(this.view);
>>>>>                }
>>>>>        }
>>>>> }
>>>>>
>>>>> Now imagine a Model with more properties.
>>>>> And tons of different Views of them that data.
>>>>> Some of which provide a UI linked to Controller methods that manipulate
>>>>> it.
>>>>>
>>>>> _ross
>>>>>
>>>>
> ______________________________**_________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.**com <Flashcoders@chattyfig.figleaf.com>
> http://chattyfig.figleaf.com/**mailman/listinfo/flashcoders<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