简体   繁体   中英

Scale button`s icon in Flex for mobile applications

Use Flex 4.5.1 and when add icons to the button is so curve effect of scaling. Prompt how to make a proportional scaling icons? 无长宽比图标

<s:Button width="100%" height="50" label="Create new map" click="button3_clickHandler(event)"
              fontSize="22" icon="@Embed('icons/001-folder.png')">

try to create custom skin for button and do the same in commitProperties

override protected function commitProperties():void
{
      super.commitProperties();

      if(iconDisplay){
           iconDisplay.scaleMode = BitmapScaleMode.LETTERBOX;
      }
}

try add creation complete handler and set btn.iconDisplay.scaleMode to BitmapScaleMode.LETTERBOX

protected function creationCompleteHandler(event:FlexEvent):void
{
    btn.iconDisplay.scaleMode = BitmapScaleMode.LETTERBOX
}


<s:Button id="btn" creationComplete="creationCompleteHandler(event)" width="100%" height="50" label="Create new map" click="button3_clickHandler(event)"
              fontSize="22" icon="@Embed('icons/001-folder.png')">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM