Select to view content in your preferred language

Change the subtitle of flex viewer dynamically from widget

3150
8
09-20-2011 06:20 AM
SaugatJoshi
Deactivated User
Hi all,

Is there a way I can change the subtitle of the Flex viewer dynamically? I have a list of tags in a combobox eg: tag 1 , tag 2 and so on in the LayerList widget. When i click on tag 1 it changes the layer visibility and now I want the tag name appear as a subtitle in the Flex viewer. How can I achieve this.
The snippet below does not seem to work. I must me missing something here....

configData.ViewerUI.subtitlle.value


Thank you.
Tags (2)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   This is what you need:
AppEvent.dispatch(AppEvent.SET_TITLES, { title: "Hello", subtitle: "World" });
0 Kudos
SaugatJoshi
Deactivated User
Saugat,

   This is what you need:
AppEvent.dispatch(AppEvent.SET_TITLES, { title: "Hello", subtitle: "World" });


Robert, Where does the addlistener go for this dispatched event?

Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   You don't have to add one the viewer already is listening for this event.
0 Kudos
SaugatJoshi
Deactivated User
Robert thanks,

I am using viewer 2.3.1 and do not see it defined anywhere.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   OK, you didn't tell me Flex Viewer 2.3.1... I will have to look how to do this in 2.3.1
0 Kudos
SaugatJoshi
Deactivated User
Robert,

For this I think in the layerList widget.
ViewerContainer.dispatchEvent( new AppEvent("subtitleChanged",subtitleP);
Then in init() of Mapmanager.mxml
ViewerContainer.addEventListener("subtitleChanged",changeSub);
,and

private function changeSub(event:AppEvent):void
   {
    configData.ViewerUI.subtitlle.value=event.subtitleP.toString()
   }


Do you think this is a correct way?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Saugat,

   No there is nothing that is listening for a change to the configData.ViewerUI.subtitlle.value you would have to add:

ViewerContainer.addEventListener("subtitleChanged",changeSub);
to the headerControllerWidget.mxml and add the changeSub fuction that would change the
bannerSubtitle.text =event.subtitleP.toString();
0 Kudos
SaugatJoshi
Deactivated User
Thanks Robert,

Solution works fine.

-Regards
0 Kudos