5 Replies Latest reply on Aug 16, 2006 9:54 PM by Matlus

    z-index? Placing and Image Over a Panel's "Title" area

    Matlus Level 1
      I'm trying to place an image on top of a Panel's Title area. Is there some way to do this? Would it be possible if I were to subclass the Panel?

      Thanks.

      Shiv.
        • 1. Re: z-index? Placing and Image Over a Panel's "Title" area
          inlineblue Level 1
          z-index is simply controlled by the order in which children are added (later children have a higher z-index). If you want to layer components, put them in a Canvas container and have their x,y coordinates overlap.
          • 2. Re: z-index? Placing and Image Over a Panel's "Title" area
            Matlus Level 1
            Thank you for your reply.

            I understand how the z-index is determined. However, when I place an image "on top" on a panel by placing the tag after the panel's tag (and it's not contained within the panel as a result), It still seems like the image it "behind" the panel.
            • 3. Re: z-index? Placing and Image Over a Panel's "Title" area
              inlineblue Level 1
              I'm not sure why you would be seeing that. Here's an example that works fine for me:

              <mx:Panel x="0" y="0" width="250" height="200" layout="absolute" title="Hello World!"/>
              <mx:Image x="30" y="0" source="someimage.png"/>

              The image layers on top of the title just fine.
              • 4. Re: z-index? Placing and Image Over a Panel's &quot;Title&quot; area
                jpwrunyan Level 1
                I think he means that the image is inside the component itself, not alongside the component in the same Canvas/Container.

                If I understand correctly, you want to put an image inside the panel but have it "on top" of the Panel's title_mc sprite, is that right?

                If I were to do something like this, I might use addChild() on the creationComplete event to guarantee that the image you are adding is placed later in the z-order than the auto-built title_mc.

                Also, simply referencing the title_mc (have to check the name, but I think it's still called "title_mc") and then adding the image as a child of it, rather than the parent Panel might be a better solution. Refer to the code for Panel if this is what you are trying to do. By the way, this would be most easily done by subclassing Panel like you said.
                • 5. Re: z-index? Placing and Image Over a Panel's &quot;Title&quot; area
                  Matlus Level 1
                  >If I understand correctly, you want to put an image inside the panel but have it "on top" of the Panel's title_mc sprite, is that right?

                  That's what I was trying to do, yes. Eventually, I gave up thought I could simply drop the image ont top of the panel and be done with it.

                  In a new application it works like inlineblue stated, however, in my existing application (must be the various properties I've changed, that is doesn't seem like it's on top, because it gats "faded" a bit. Now that I'm writing this, I think it's probably because I have the alpha value set to 0.50 :)

                  >Refer to the code for Panel if this is what you are trying to do
                  Yes, I think I'm going to do that.

                  Thanks.

                  Shiv.