How to remove a widget from memory?

2180
1
Jump to solution
06-06-2012 10:52 AM
FarhadNavaei
New Contributor III
Hi,

It seems to me that closing a widget does not remove it from the memory, so that next time when I reopen it, it creates another instance of the widget, while the first one still is there. It affects the behavior of the widget in my application. For example when I set the "isResizeable" to  "false", it works first, but the second time that I open the widget, it doesn't work. Also "active" event in BaseWidget is active even after closing the widget. Is there any way to remove widgets from memory after closing it?

Thank you
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
IvanBespalov
Occasional Contributor III
if you find com.esri.viewer.skins.WidgetTemplateSkin.mxml,
you'll understand
1 - each widget has 5 states(by default)
<!-- in com.esri.viewer.skins.WidgetTemplateSkin.mxml --> <s:states>         <s:State name="normal"/>         <s:State name="open"/>         <s:State name="minimized"/>         <s:State name="closed"/>         <s:State name="disabled"/> </s:states>


2 - widget and it's child components visibility, accessibility ... regulated by the state of widget.
for example: if widget state is "closed" - it's main container is fully transparent
<!-- in com.esri.viewer.skins.WidgetTemplateSkin.mxml --> <!-- the widget template wireframe --> <s:Group id="widgetFrame"              left="0" right="0" top="0" bottom="0"              alpha.closed="0">

minimize&close buttons container and it's childs is not visible, when widget is in "minimized" state
<s:Group id="minclose"              height="30"              right="3" top="0"              includeInLayout.minimized="false"              visible.closed="false"              visible.minimized="false">


when I reopen it, it creates another instance of the widget

No.

Because, when you click on widget close button - NOTHING happens with widget and it's contents, but it's transparency changes to fully transparent.
And, when you open closed/minimized widget you just change it's transparency.
[INDENT][INDENT][INDENT]:rolleyes:[/INDENT][/INDENT][/INDENT]

P.S. FlexViewer has no mechanism to unload modules (I did not find any). If you really want to unload smthing take a look to adobe forums and blogs.

View solution in original post

1 Reply
IvanBespalov
Occasional Contributor III
if you find com.esri.viewer.skins.WidgetTemplateSkin.mxml,
you'll understand
1 - each widget has 5 states(by default)
<!-- in com.esri.viewer.skins.WidgetTemplateSkin.mxml --> <s:states>         <s:State name="normal"/>         <s:State name="open"/>         <s:State name="minimized"/>         <s:State name="closed"/>         <s:State name="disabled"/> </s:states>


2 - widget and it's child components visibility, accessibility ... regulated by the state of widget.
for example: if widget state is "closed" - it's main container is fully transparent
<!-- in com.esri.viewer.skins.WidgetTemplateSkin.mxml --> <!-- the widget template wireframe --> <s:Group id="widgetFrame"              left="0" right="0" top="0" bottom="0"              alpha.closed="0">

minimize&close buttons container and it's childs is not visible, when widget is in "minimized" state
<s:Group id="minclose"              height="30"              right="3" top="0"              includeInLayout.minimized="false"              visible.closed="false"              visible.minimized="false">


when I reopen it, it creates another instance of the widget

No.

Because, when you click on widget close button - NOTHING happens with widget and it's contents, but it's transparency changes to fully transparent.
And, when you open closed/minimized widget you just change it's transparency.
[INDENT][INDENT][INDENT]:rolleyes:[/INDENT][/INDENT][/INDENT]

P.S. FlexViewer has no mechanism to unload modules (I did not find any). If you really want to unload smthing take a look to adobe forums and blogs.