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

Pages: [1]
Print
Author Topic: How to register mediator on run with tree navigation  (Read 9496 times)
Arno
Newbie
*
Posts: 5


View Profile Email
« on: July 22, 2009, 11:53:42 »

I have an application that has a large number of views so I use a viewstack and a tree as menu. But like in the Slacker example I can't just set a dispatch event on every menu item. So how can I know in the mediator what item is clicked without writing code double or have a switch statement?

I hope I explained it good enough
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: July 26, 2009, 10:44:42 »

Have the view component that contains the tree handle the ITEM_CLICKED event, investigate the target property and set a public property on the view component exposing a reference to the item clicked. Then send a corresponding event that the mediator is interested in. The mediator looks at the exposed public property on its view component to know what was clicked and doesn't need to know about the tree.

-=Cliff>
Logged
isragaytan
Full Member
***
Posts: 22


View Profile Email
« Reply #2 on: July 29, 2009, 05:38:00 »

And dont forget in the Custom Event to put in the constructor:

super(evt,true,true)

for bubbling.

Cheers
Logged
Pages: [1]
Print