3 Replies Latest reply on Jul 11, 2011 4:48 PM by doctorshake

    Images as Buttons and Image Resizing in mxml


      I've run into a problem when trying to create buttons that are just an image in mxml. When I first tried this I couldn't find a way to get the border around the button to dissapear so it ended up looking like my image had an extra black border around it. Then someone here suggested I just set the buttonMode property of an mx:Image to true which ended up working fine to a point. The problem I'm having is that even if I make the tabEnabled property of the image (that I'm using as a button) true, I can't tab over to it. Is there a way to either get rid of the black borders of a button or to make it so I can tab over to an image I'm using as a button?


      My second question has to do with image resizing. Lets say I have an image of a horizontal line that I want to put at the top of the mxml page, and I want it to extend the full length of the page, even after the user has resized the browser. Is there a way to do that? I've tried putting the width as 100% or giving the image a "left" and "right" value so that presumably it would be stretched to fit within those but nothing has worked so far. Is there no way to do this or am I doing something wrong?


      Thank you for any help you guys can give.

        • 1. Re: Images as Buttons and Image Resizing in mxml
          _spoboyle Level 4

          please supply some code

          • 2. Re: Images as Buttons and Image Resizing in mxml
            doctorshake Level 1

            Of course, sorry about that. So the following is a barebones example of how I currently implement buttons and images as buttons:


            <mx:Button id="facebookButton" icon="@Embed(source='image.png')" width="30"/>


            <mx:Image buttonMode="true" id="button" source="anotherimage.png" enabled="true" click="{foo()}"/>


            And within the image I've tried making the tabFocusEnabled property true but to no avail.


            The following is how I've tried stretching out an image across the whole page:


            <mx:Image source="yetanotherimage.png" width="100%" scaleContent="true"/>


            <mx:Image source="yetanotherimage.png" left="10" right="10" scaleContent="true"/>


            Is this more helpful?

            • 3. Re: Images as Buttons and Image Resizing in mxml
              doctorshake Level 1

              I was able to solve the image rezizing problem however I was wondering if anyone had any ideas about the button issue I had though, I've just been a bit frustrated with it.


              Also does anyone know how to force Flash to make the browser have scrollbars once the browser size reaches a certain point? As it stands whenever I resize images tend to just go over each other if I make the window too small.


              Thanks again!