3 Replies Latest reply on Sep 18, 2009 11:26 AM by Ansury

    How to put image on the top layer

    xkfjvxv

      Hello,

       

      I want to display my image on the top of everything . Now it's hidden by other things. In html there a CSS property called z-index. What about flec any equivalence?

       

      Regards

        • 1. Re: How to put image on the top layer
          msakrejda Level 4

          Unfortunately, no explicit z-index in Flex (z-index is essentially inferred from the order the children were added to the container). I recently had to add an overlay. I didn't really find any "best practices" and ended up adding an overlay using rawChildren.I also had to an an event listener to RESIZE events to reposition the overlay. So far, this is working reasonably well.

          • 2. Re: How to put image on the top layer
            FlexAppsStore.com

            Hello,

             

                 To expand on the previous answer, we have used a method in the past that seems to work consistently for dynamic images. It does require that each image has its own unique id property and exists within a container (i.e. - Canvas).

             

                 canvasId.removeChild({your image});

                 canvasId.addChild({your image});

             

                 These events are called whenever you need to return an image to the top of the viewing area.

             

            Kind regards,

             

            Dr. Ivan Alexander, Ph.D.
            Sr. Applications Engineer
            Sun Microsystems

            MySQL Enterprise Ready Partner 2009

            • 3. Re: How to put image on the top layer
              Ansury Level 3

              If you're just putting it inside an MXML file, simply put it after the stuff you want it to be in front of in the file.  If they overlap at all, the last items in the mxml file will be displayed on top.  The reason addChild/removeChild works is because it's doing exactly this via actionscript, but if you're not doing any such fancy actionscript, there's no need.

               

              If you are doing such manipulation at run time, you may also find addChildAt() and removeChildAt() useful, these let you specify the index (position) of the child component.