0

How is it possible to remove extra space in spark button?

a busy cat
(source: turboimagehost.com)

So i need the image or text starts exactly with left border of the button

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Max
  • 1,090
  • 10
  • 23

1 Answers1

1

You will need to define a new skin for your Button. CSS:

s|Button {
   skinClass:ClassReference("skins.MySkin");
}

MySkin.mxml will be a copy of Flex\frameworks\projects\spark\src\spark\skins\spark\ButtonSkin.mxml

Then you can change the value left="10" for labelDisplay or add a BitmapImage called iconDisplay and set its left value.

Kodiak
  • 5,978
  • 17
  • 35
  • For label it works fine! but for icon not :( I have: and skin: I still have a space. – Max May 16 '12 at 08:49
  • Have you set your BitmapImage's id to "labelDisplay" ? – Kodiak May 16 '12 at 08:59
  • yes, "labelDisplay" generates error: Error: Attempting to initialize inherited property 'labelDisplay' of type 'spark.core.IDisplayText' with value of incompatible type 'spark.primitives.BitmapImage'. if I use >source="@Embed('t1.png')" if skin, it works fine – Max May 16 '12 at 09:22
  • I get: Error #1009: Cannot access a property or method of a null object reference With simply id="icon" I has no effect – Max May 16 '12 at 09:26
  • Mmh sorry, I can't tell without more info about the error. Here is what states the Flex reference: iconDisplay:BitmapImage Required: false Part Type: Static A skin part that defines an optional icon for the button. – Kodiak May 16 '12 at 09:27
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/11314/discussion-between-max-and-kodiak) – Max May 16 '12 at 09:41