Select to view content in your preferred language

Closing Widget in Flex Viewer 2.4

553
3
08-16-2011 05:50 AM
sreeharikottoormadam
Occasional Contributor
How to close a widget completely in flex viewer 2.4?

clicking the "x" in upper right is not closing the widget completely. I need to close a widget and open it newly (need to get initialize and widgetConfigLoaded events)

tried the below code in my widget but doesn't seem to work. Next time when I open the widget, it is not even capturing the events initialize and widgetConfigLoaded.

//open the widget    
AppEvent.dispatch(AppEvent.WIDGET_RUN,ViewerContainer.getInstance().getWidgetId("MyWidget"));
       

//close the widget (closed="widgetClosedHandler(event)")
private function widgetClosedHandler(event:Event):void
  {
  
   AppEvent.dispatch(AppEvent.WIDGET_CHANGE_STATE,{id:this.widgetId,State:WidgetStates.WIDGET_CLOSED});
  
  
  }


any help?
Tags (2)
0 Kudos
3 Replies
KeithGerhartz1
Frequent Contributor
Did you ever get an answer to this? I am also trying to address. Thank you.
0 Kudos
HaroldBostic
Frequent Contributor
One issue maybe that the s needs to be lowercase in

State:WidgetStates.WIDGET_CLOSED

should be

state:WidgetStates.WIDGET_CLOSED
0 Kudos
omega_cancer
Frequent Contributor
Why do you want to re-open it any way?
I was having the same issue of re-loading settings, layers and other stuff,I solved it by catching initialize, widgetConfigLoaded and addedToStage events in conjuction with a global bool variable to hold value to see if it is fresh run for the widget or it was closed.
It is working for me in many widgets right now.
Thanks
0 Kudos