3 Replies Latest reply on May 5, 2010 6:54 AM by David_F57

    Flex 4 - TitleWindow + Display Icon

    Agent-96

      Is it possible to have an icon displayed next to the title text of a TitleWindow?  (in Flex4)

        • 1. Re: Flex 4 - TitleWindow + Display Icon
          David_F57 Level 5

          hi,

           

          You can have a custom skin then set the image in it, for example if you copy the titlewindow skin and got to the layer 3: text line and insert a bitmap tag then adjust the title label position to the give enough space for an icon,

           

           

           

          <!-- layer 3: text -->  <=== go to here in new skin

          <!--- @copy spark.components.Panel#titleDisplay -->

          <s:BitmapImage source="icon.png" left="5" width="24" top="3" bottom="3" fillMode="clip"/> <=== added to skin

          <s:Label id="titleDisplay" maxDisplayedLines="1"

                         left="36" right="36" top="1" bottom="0" minHeight="30"   <=== left changed from 9 to 36.

                         verticalAlign="middle" fontWeight="bold" />

           

           

           

          David.

          • 2. Re: Flex 4 - TitleWindow + Display Icon
            Agent-96 Level 1

            Thank you this works well, and now I've learnt about skinning!

             

            I have also subclassed the TitleWindow an added an image attribute so I can change the image at runtime.

             

            Thank you for your help.

            • 3. Re: Flex 4 - TitleWindow + Display Icon
              David_F57 Level 5

              hi,

               

              Glad to have pointed you in the right direction, the new skinning is incredibly powerful, you can do so much even subclassing a component. The following example which was one of my early experiments with skinning might interest you a little. It uses a skin to replace using a reflection class and its dynamic.

               

              http://gumbo.flashhub.net/reflect/  source included

               

               

              David.