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: ViewStacks, Mediators and Deferred Instantiation on: March 11, 2008, 10:27:41
I do bind activeView, but it's not binded at the application startup, (or after the mediator instanciation).

and I actually have a mediator for each viewstack item, but I need to have several viewstacks. it's easier to explain with this:

Main.mxml contains:
    - NavComponent.mxml (linked to mediator)
    - InfoBarComponent.mxml (linked to mediator)
    - a viewStack with (at this time) 2 view items HomeComponent.mxml and MessageBoard.mxml (both linked to related mediators)

HomeComponent.mxml contains:
    - several buttons sending notifications linked to a command, and listened by MainMediator to make the viewStack switch between different views (at this time only messageBoard available)

MessageBoard.mxml contains:
    - a viewStack with 3 items ListMessagesComponent, ReadMessageComponent and WriteMessageComponent (all linked to mediators)


you can then see that when I launch my app, it calls the HomeComponent in the main viewstack. We then select the "message board" button, wich calls the MessageBoard component in the main view stack.
with this, there is no problem with your method.
but if I use your method in chain (so if I call my ListMessageMediator in the MessageBoard constructor), I receive a "null" because flex seems to need a time to show the main viewstack item, and another time to show the message viewstack.


I got my solution adding a onComplete event listener in my ListMessageMediator (and so in other mediators)

do you think on an easier way?

makar

2  Announcements and General Discussion / Architecture / Re: ViewStacks, Mediators and Deferred Instantiation on: March 11, 2008, 04:04:45
the checkForMediator is the same as yours : try to retrieve proxy, and create it if null.
but the problem doesn't come from the method, but from the "activeView" returning null at first time.
it's not binded at the beginning, so we can't instanciate it as you do in your exemple.

it only works if I add a "activeView=viewstack.selectedChild" on the onCreationComplete event.
and if my viewstack.selectedChild contains himself another viewStack, then I have to add a creationComplete event also in my mediator since I can't access directly the children in the constructor.

(there's also the public const GALLERY, etc... that you cast as strings... they might be an int, isn't it?)

thanks,
PiR

3  Announcements and General Discussion / Architecture / Re: ViewStacks, Mediators and Deferred Instantiation on: March 10, 2008, 02:00:40
Hi!

was happy to find this topic, as my application is nearly only viewStack based components inside eachothers... but it doen't work.
I'm not new with MVC+C (AS2 pixlib addict :) but Flex and PureMVC are new for me.

can somebody tell me where I'm wrong?

main.mxml has :
     2 perso very simple components (for navigation, so contains only buttons)
     one viewStack, holding either a Home.mxml component or a antoher view
     and cliff'code with activeView and currentView, etc...


I've put all the habitual staff with Startup Notification : this works

the startup command is a macrocommand, calling ModelPrep and then ViewPrepCommand... this works also

the viewPrep Command registers my ApplicationMediator :
     the constructor has this
:
super(NAME,viewComponent);
trace("app : "+app);  // traces the get method for giving back casted viewcomponent
trace("app nav : "+app.toolBar);   // traces the first simple navigation component
trace("currentView : "+app.currentViewSelector);
trace("activeView : "+app.activeView);
checkForMediator(app.currentViewSelector,app.activeView);

the result is:
app : Main
app toolbar : Main.toolBar
currentView : 0
activeView : null


I always get a null has main viewstack item but it's displayed on the screen...
so when is it created, why do I receive a null ??

please help
thx

Makar

Pages: [1]