2 Replies Latest reply on Sep 28, 2009 7:36 AM by timo888

    Possible to hide an mxml component using display:none style?

    timo888 Level 1

      Question: Is there a way to make a re-used mxml component invisible and take up no space?



      My app may be having a memory/garbage collection issue and toggling visibility may improve things.


      In my app, the user chooses which kind of search, standard or proximity.  The proximity search asks for two search terms and the distance between them. The standard search asks for only one search term and there's no distance widget.  So I have separate search-term-dialogs (each is an mxml component) and, based on the user's choice from a menu, I add the appropriate component to a panel, after removing all children from the panel.  This works fine, but once in every 50 choices or so, the main menubar menu click event returns -1 as the index for the selected menu item. That's why I suspect a memory issue.


      To that end, I am exploring ways to add both dialogs to the panel only once, and toggling their visibility as needed.


      However,  myStandardDialog.visible=false is not going to work because, as with HTML/CSS, an invisible component still consumes space.(My mxml dialogs are being placed in the upper panel of a VDividedBox, BTW.)


      In HTML, if you want to collapse the space taken up by a undisplayed object, you'd use {display:none} style.  But I do not see any way to assign a stylesheet to an mxml component; nor does invoking the setStyle("display", myHiddenStyleObject) method from the component appear to work.

      So, is there a way to make a re-used mxml component invisible and take up no space?  Again, the special requirement is that the mxml component I want to make invisible is a child of a Panel placed in a VDividedBox.