5 Replies Latest reply on Apr 8, 2009 1:17 AM by clayronus

    Text on an Image?

    Shelady Level 1

      Hi,

      I have a HBOX and in that I have an Image with image tags. I want to write some text on TOP of that image so that I can see the image behind the text.

      Any suggestions?

      Thanks

        • 1. Re: Text on an Image?
          Gregory Lafrance Level 6

          Canvas positioned over the HBox, or better yet, positioned over the image.

          • 2. Re: Text on an Image?
            Ansury Level 3

            You can just drop a Label on top of the image. By "on top" I mean, in MXML the tag should appear after the image.

            • 3. Re: Text on an Image?
              Shelady Level 1

              I tried to drop a canvas on top of the Image but it is making my picture shrink and taking up the space on the left and not on top of the image.

               

              Here is my code

               

               

               

               

               

               

               

               

              <?xml version="1.0" encoding="utf-8"?>

              <mx:Application

               

              xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" verticalAlign="middle" horizontalAlign="center"

              >

               

               

               

               

               

              <mx:HBox width="200" height="230" backgroundColor="#000000">

               

               

              <mx:Image scaleContent="true" source="images/s1.jpg" height="100%

              "

              width="

               

              100%" verticalAlign="middle" horizontalAlign="center

              "

              maintainAspectRatio="

               

              false"

              />

               

               

               

              </mx:HBox>

               

               

               

               

              </mx:Application>

              • 4. Re: Text on an Image?

                Hi, try this, it should be helpful for you

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                <?xml version="1.0" encoding="utf-8"?>

                <mx:Application

                xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute

                "

                verticalAlign="

                middle" horizontalAlign="center"

                >

                 

                 

                <mx:HBox

                width="400" height="230" backgroundColor="#000000"

                >

                 

                 

                <mx:Canvas

                width="200" height="230" backgroundColor="#000000"

                >

                 

                 

                <mx:Image scaleContent="true" source="../images/s1.jpg" height="100%

                "

                width="

                100%" verticalAlign="middle" horizontalAlign="center

                "

                maintainAspectRatio="

                false"

                />

                 

                <mx:Label text="it's a textline" width="96"

                />

                </mx:Canvas>

                <mx:Label

                text="it's HBox element"

                />

                </mx:HBox>

                 

                 

                 

                </mx:Application>

                • 5. Re: Text on an Image?
                  Shelady Level 1

                  Great

                   

                  Thanks