Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Architecture / Re: Tool and Canvas Architecture on: July 23, 2009, 02:35:35
Thanks for the advice.  It helped me greatly in framing out my toolbar and cursor development.

Now I'm trying to identify another approach for dealing with the drawing objects that the tools will create.

In flash, my process would generally be:

1. On click, create temporary shape, save reference to it in canvas.
2. On mouse move, update shape properties based on X/Y coordinates of Mouse
3. On release, stop updating shape and leave it where it stands.


Within PureMVC I am trying to implement a drawing framework that is Command based and utilizes, Add, Update, and Delete methods so I can build-in an undo stack.


So here is my current thought process on how that will need to be accomplished.

1. On mouse click, trigger Add Draw_Object command.
2. D_O Command generates UniqueName for drawing object.
2. D_O Command calls canvas function to create new Rectangle movie clip, function returns MC.
3. D_O Command creates a new Draw_Object proxy who's only member variable is a reference to the stage MC using the UniqueName.
4. D_O Command references CanvasContentsProxy and Adds new Draw_Object to the CanvasItems array.
5. D_O Command creates new Mediator for Draw_Object using the UniqueName.
6. Notification is Dispatched for Canvas to update view based on contents of CanvasContents' CanvasItems array.
7. Undo comand is stored in UndoStackDO.
8. Command Complete.

Does this seem like I am overcomplicating things?

I sure feel like it.

Thanks,

-Scott

2  Announcements and General Discussion / Architecture / Re: Tool and Canvas Architecture on: July 10, 2009, 06:55:16
Cliff,

I went back and looked through that wiki link again, which is how I ended up solving my dilemma.

But I do have a question for you regarding application folder structure.

I have a tool interface, and then a handful of tools that implement that interface.  My CanvasMediator is filtering mouse events through the tools.

But where is a good place to sit these files?  They seem out of place right now sitting in the root of my view folder.... so where would you tuck them away?

Thanks,

-Scott
3  Announcements and General Discussion / Architecture / Re: Tool and Canvas Architecture on: July 08, 2009, 07:12:57
Cliff,

Thanks for the suggestions, hopefully somebody has some insight to share.

My issues are less with PureMVC and more with changing my approach and thought processes when  developing.  I'm so used to tightly integrating my application logic with references to the views in Flash/AS3 that it is very unnatural right now for me to think about abstracting everything out into separate modules.

The more examples I look at and the more reading and thinking I do, the closer I feel I'm coming.

Thanks,

-Scott
4  Announcements and General Discussion / Architecture / Tool and Canvas Architecture on: July 08, 2009, 09:28:05
I've been working through converting the beginning of a Flash/Air based application that is a simple drawing program as a test-case for developing a new larger-scale Flash/Air project on the PureMVC framework.

Now that I have spent some time running through examples and getting a pretty good understanding of the framework, I'm having a little bit of trouble trying to model out an implementation model for a ToolBar and Drawing Canvas.

The ToolBar is set up as a View/Mediator pair that sends notifications to the canvas of what the currently selected Tool is.  And the Canvas is set up to handle mouse click events and manage user input.

What I am struggling with is the best-practice approach for implementing the individual tool components and how they would properly fit into a PureMVC application.

For example.  I have a ToolBar, and the user selects the square tool.  This dispatches a notification to the Canvas to filter all user input through a Tool, and allow the Tool to direct the output that is displayed on the canvas.

Before PureMVC I would typically write a base Tool interface, which my ToolSquare would implement, having mouse down, mouse up, and mouse move handlers.  Then the ToolSquare would manage the input, run it through a series of functions to create the drawing object to be added to the canvas, and then dispatch an "AddToCanvas" CustomEvent that would pass a drawing object to the stage.

With PureMVC I would likely dispatch a CreateSquare, {properties} notification that the CanvasMediator would handle, calling the proper View functions to create the drawing object.

But what is the best practice approach for sticking a currently selected Tool within the path of the user input caught by the mediator.

Should I handle a tool as a View Component, like a Button, therefore writing a separate base class library to handle input based on the Interface?  Should the tool be a Command structure that dispatches Notifications based on input?

Am I at all on the right track here?

I'm really excited to dig into this framework and apply some more rigid and better organized development methodologies within the applications we develop here--but just like learning AS3 and the Event model, this is a definite shift in approach from how I am used to thinking.  Definitely it feels like the right direction, I'm just trying to get my habits to catch up.

Any input you folks might have on an approach to architecture here would be appreciated.

Best,

-Scott
Pages: [1]