7 Replies Latest reply on Jul 10, 2010 1:01 PM by Shongrunden

    Reposition of a component to the top of the display list

    PHANTOMIASA Level 1

      Hello!

       

      I have a Main.mxml in which I create several MyComp.mxml with:

      var myComp1:MyComp = new MyComp();
      myComp1.x = 10;
      myComp1.y = 10;
      this.addElement(myComp1);
      

      With this.addElement(myComp1); I added it onto the main screen which have a background image and a text label.

       


      Now everything is okay, but the last added Element this is the highest, so if I drag'n'drop these elements it is all over other elements. But, if I catch and move an element which was added first, all other components laid in front and this dragged element under all others.

       

      The problem is explained here: Working with display containers

      http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context =LiveDocs_Parts&file=00000148.html

       

      Here is explained, that this can be forced, that if I want to have the currently selected component at the highest position, I have to make a

      container.addElement(myComp1);
      

      So it will be removed and newly added, so it is in front.

       

      But I have another architecture:

      The startDrag() and stopDrag() functions are implemented in the component MyComp. So if startDrag() is triggered, I have to make it at this position that this component will be "on top of the display list".

       

      I hope someone can help me to solve this problem!

       

      Thanks a lot in advance & Best Regards.