Search Results

Search found 1 results on 1 pages for 'combustion007'.

Page 1/1 | 1 

  • New to MVC. Actionscript 3.0 Appreciate your help.

    - by Combustion007
    Hello Everyone, I am new to design patterns and am trying to learn the MVC implementation. I have written four classes: DataModel DataView DataController Main Main serves as the application facade. The main FLA is called HelloWorld. I have a symbol called "Box" in HelloWorld. I just would like to add an instance of the "Box" on the stage. Eventually I would like to place a button and when the button is clicked, the Box instance color will be changed. I would appreciate any help, please help me figure out what am I doing wrong. Here are my Classes: DATAMODEL CLASS: package { import flash.events.*; public class DataModel extends EventDispatcher { public static const UPDATE:String = "modelUpdate"; private var _color:Number = (Math.round(Math.random()* 0xffffff)); public function DataModel() { trace("DATA MODEL INIT"); } public function get color():Number { return _color; } public function set color(p:Number):void { _color = p; notifyObserver(); } public function notifyObserver():void { dispatchEvent(new Event(DataModel.UPDATE)); } } } //DATACONTROLLER CLASS: package { import flash.events.; import flash.display.; import flash.errors.*; public class DataController { private var _model:DataModel; public function DataController(m:DataModel) { trace("DATACONTROLLER INIT"); _model = m; } } } DATAVIEW CLASS: package { import flash.events.; import flash.display.; import flash.errors.*; public class DataView extends Sprite { private var _model:DataModel; private var _controller:DataController; private var b:Box; public function DataView(m:DataModel, c:DataController) { _model = m; _controller = c; b = new Box(); b.x = b.y = 100; addChild(b); } } } And Finally THE FACADE: package { import flash.display.; import flash.events.; import flash.text.; import flash.errors.; public class Main extends Sprite { private var _model:DataModel; private var _controller:DataController; private var _view:DataView; public function Main(m:DataModel, c:DataController, v:DataView) { _model = m; _controller = c; _view = v; addChild(v); } } } When I test the movie: I get this error: ArgumentError: Error #1063: Argument count mismatch on Main(). Expected 3, got 0. Thanks alot.

    Read the article

1