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 / Re: AS3/Flash Where to put code for visual transitions on: April 08, 2009, 02:24:09
Moreover I prefer not to encapsulate the transition code inside each ViewComponents. I think, but I don't know if it's the right approach, that encapsulating too much code make the components code less reusable.
In a more complex example than my first minimal example, suppose to have a section/component which displays a set of pictures displayed in a grid (a very common situation, where the code could be reused a lot of time). The "transition out" could have a lot of implementation: move each picture out of the screen, change their alpha to 0, etc. etc. Each implementation are specific of a concrete application, so in my opinion is better to manage this in a specific class. In general I do this, but this is the first time I use pureMVC framework...so I have to rethink my habit and try to "save the savable".
And here come out my need to find the right place in which write this code...
2  Announcements and General Discussion / Getting Started / Re: AS3/Flash Where to put code for visual transitions on: April 08, 2009, 01:34:27
Hi, my NavBar is a custom class. I don't know what it is NavBar in Flex (I have never developed in Flex), however this component doesn't have a reference to the "container" (container is just a dummy component where I add the true content of the application).
Your solution sounds good for my minimal example....but in my real application I have a lot of interactive components that could change sections (for example in each section I could have products previews, and a click on them could trigger a section change).
3  Announcements and General Discussion / Getting Started / Re: AS3/Flash Where to put code for visual transitions on: April 08, 2009, 12:40:01
Hi Cliff, the problem is that my components don't know anything about other components, they are totaly decoupled from each other, the communication between the elements of the system is made with notifications. Maybe I could create a run time Mediator(for example MoveUpMediator) with a MoveUpComponent (not a display object) that control the transition between the two section. This component must hold a reference with the components involved in the transition (for example section1, section2, stage). What I mean is not writing the transition code inside the mediator but inside the component. The mediator listens for notification like: TRANSITION_START and TRANSITION_COMPLETE and calls public method in his component.
What do you think about this solution?
4  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...
5  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]