[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to decrease the size of a button which contains an image?

Posted on 2011-05-12
8
Medium Priority
?
333 Views
Last Modified: 2012-05-11
How to decrease the size of a button which contains an image?

I have a button in which it contains an image.But my problem here is i am unable to decrease the width of the button along with image.

If you observer in the screen shot all images are small excpet the line image.

If possible provide me some sample code.

Below is my sample code:

 <mx:Button id="line" toggle="true" paddingLeft="1" paddingRight="1" icon="@Embed(source='Images/line.png')" toolTip="Line" useHandCursor="true" buttonMode="true" click="doDrawEnable()" ></mx:Button>

Thanks,
Alam.
Demo.doc
0
Comment
Question by:alamflex
  • 3
5 Comments
 
LVL 29

Accepted Solution

by:
dgofman earned 2000 total points
ID: 35749225
Try this

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%">
      <fx:Script>
            <![CDATA[
                  import mx.core.IFlexDisplayObject;
                  import mx.core.mx_internal;
                  import mx.events.FlexEvent;

                  protected function changeIconSize(event:FlexEvent):void
                  {
                        var button:Button = event.target as Button;
                        var icon:IFlexDisplayObject = button.mx_internal::currentIcon;
                        icon.width = 20;
                        icon.height = 20;
                        button.invalidateDisplayList();
                  }

            ]]>
      </fx:Script>

      <mx:Button id="line" toggle="true" paddingLeft="1" paddingRight="1"
                     icon="@Embed(source='Images/line.png')" toolTip="Line"
                     useHandCursor="true" buttonMode="true"
                     click="doDrawEnable()" creationComplete="changeIconSize(event)"/>
</s:Application>
0
 

Author Comment

by:alamflex
ID: 35752290
Hi Thanks for your reply,

I don't want zooming effect. just i need constant button which contains line image over it.The code which you have provided is zooming. I want a button like it should be pressed when we click on line button similar to toggle button on/off effect should be there.so that user user can come to know whether that button is pressed or not.
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35758430
set explicite width and height

  <mx:Button width="100" height="100"/>
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35797213
What solution are you looking for?>
0
 

Expert Comment

by:WallyMod
ID: 35909940
No response from the OP so proceeding with applicable solution

WallyMod
Community Support Moderator
0

Featured Post

Cyber Threats to Small Businesses (Part 1)

This past May, Webroot surveyed more than 600 IT decision-makers at medium-sized companies to see how these small businesses perceived new threats facing their organizations.  Read what Webroot CISO, Gary Hayslip, has to say about the survey in part 1 of this 2-part blog series.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question