Flex icon on the Size [Design] button
I would like to change the width of my button to match its icon image. I tried to force fill to 0 with no success.
In tiles
<mx:Button id="m1" icon="@Embed('m1.png')"/>
See result
http://img513.imageshack.us/my.php?image=iconkg3.png
How can I change this space?
icon http://img513.imageshack.us/my.php?image=iconkg3.png
Thank.
0
source to share
1 answer
Add a listener to createComplete event and you can use this code:
private function OnCreationComplete(event: Event): void
{
if (event.target is Button)
{
var button: Button = (event.target as Button);
var icon: DisplayObject = button.getChildByName("upIcon");
if (icon) // check icon existence
{
button.width = icon.width;
button.height = icon.height;
}
}
}
Must work...
+3
source to share