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 / Getting Started / AS3/Flash Where to put code for visual transitions on: April 07, 2009, 03:19:54
Hi there, I have a big doubt: where to put the code that generate transitions between different sections? I have an application (flash/as3). In the stage I have a navBar(component->mediator) and a container(component->mediator). In the container I add in runtime the sections (section->mediator). When I click on a button on the navBar component, the mediator send a notification (i.e. changeSection). This notification must trigger a transition. Suppose that the transition is a tween (a very simple situation) on the y property that moves a component/section out of the stage and moves another inside (i.e.
Tweener.addTween(component1, {y:-compoment.height, time:1, transition:"easeOutSine"});
component2.y=stage.stageHeight;
Tweener.addTween(component2, {y:0, time:1, transition:"easeOutSine"});
).
Here is the doubt...where to put the code that create and control the transition? I can put a listener in each mediator...but if I have a lot of transition type (i.e. moveUp, moveDown, moveLeft, moveRight...) I will have too many listeners (in the "best practice" doc I read that the mediators must have few listeners). Another problem is that often I need to know some information of other components (like width, height, y, x etc.) and in this way I must retrive a mediator from another mediator (coupling the classes). Another way is to put all the code in a command (so I will create a command for each transition)....but in this way I must retrive mediators and get the componentView through a getter (and I don't know if it's a best practice)....so what to do? Another way (but it seems to be very close to the last one) is to create a mediator for each transition...
2  Announcements and General Discussion / Getting Started / Passing stage size to components on: March 30, 2009, 01:52:24
Hi there, I'm new in pureMVC so sorry if my question is a little bit stupid. I create some Mediators/Components and I want the sprites positions and sizes in the components are set before the component is added to the displayList (often positions and sizes depends on the stage size). Usally (not in pureMVC projects) I pass the stageWidth and the stageHeight or a reference to the stage to the component constructor. In pureMVC I'm not sure about what to do. Maybe I could retrieve the stage from the StageMediator (exposing the componentView) when I create mediator/component, but I'm not sure it's a "best practice": in this way I couple the new Mediator with StageMediator. Have you got any suggestion? Thanks in advance.
Pages: [1]