0 Replies Latest reply on Nov 27, 2006 1:10 AM by kueby

    Problem with the MenuBar and how can i delete a own component out of the storage

    kueby
      Hello,

      I opened this thread in the category "Flex Builder 2", but under this category my questions fit better.

      I have a problem with the MenuBar and a question to delete a component out of storage.

      1. We have implemented the MenuBar, which was filled dynamically with XML data.

      Sporadically it will appear following fault, if we "mousover" the root layer.

      RangeError: Error #2006: Der angegebene Index liegt außerhalb des zulässigen Bereichs.
      at flash.display::DisplayObjectContainer/addChildAt()
      at mx.managers::SystemManager/ http://www.adobe.com/2006/flex/mx/internal::rawChildren_addChildAt()
      at mx.managers::SystemManager/addChild()
      at mx.managers::PopUpManager$/addPopUp()
      at mx.controls::Menu/show()
      at mx.controls::MenuBar/::showMenu()
      at mx.controls::MenuBar/::mouseOverHandler()

      Here a abrid ged version of our XML to create the MenuBar:

      <Menuebar>
      ...
      <menu label="Artikel">
      <menu label="Artikel anlegen" data="new_article" />
      <menu label="Artikel bearbeiten" data="edit_article" />
      <menu label="Verpackung">
      <menu label="Verpackung anlegen" data="new_package" />
      <menu label="Verpackung bearbeiten" data="edit_package" />
      </menu>
      <menu label="Materialgruppe">
      <menu label="Materialgruppe anlegen" data="new_materialgroup" />
      <menu label="Materialgruppe bearbeiten" data="edit_materialgroup" />
      </menu>
      </menu>
      ...
      </Menuebar>

      It is a well-formed XML.

      2. Delete a component out of storage
      We have some own components (basically forms), which will be created and shown by an construct e.g.
      var myComponent : T_Component = new T_Component ;
      this.addChild(myComponent)

      Some of our forms will be created in an popup. On every call of the popup, we lost 5 mb or more, all childs on the windows will be removed by formname.removeAllChild();
      What cann we do, that the garbage collector will dispose this objects.
      Is there a way to show all objects with references (NOT NULL)?

      I have read in the Flex Help, that this.removeChild(myComponent) not delete the form and/or object out of the storage.
      Rather the object must be destroyed.

      It is sufficient to call delete(myComponent) about remove this object out of the storage as the case may be that the garbage-collector remove this object at any time?
      Or how can I destroy a component correctly. What happens with the widgets on this component e.g. input fields or datagrids?
      Are they also being deleted?

      Thanks for your help.

      Matze