zoukankan      html  css  js  c++  java
  • Styling a Flex Button control using embedded fonts(转载)

    The following example shows how you can customize the appearance of a Flex Button control by using an embedded font and removing the Button’s default skin.

    Full code after the jump.

    View MXML

    <?xml version="1.0" encoding="utf-8"?>
    <!-- http://blog.flexexamples.com/2007/08/28/styling-a-flex-button-control-using-embedded-fonts/ -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        applicationComplete="init()"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
    
        <mx:String id="fileName" />
        <mx:String id="fileSize" />
    
        <mx:Script>
            <![CDATA[
                private function init():void {
                    var appInfo:LoaderInfo = Application.application.loaderInfo;
                    /* Just grab the filename from the SWF URL. */
                    fileName = (appInfo.url).split("/").pop();
                    /* Convert bytes to kilobytes. */
                    fileSize = (appInfo.bytesTotal / 1024).toFixed(2);
                }
            ]]>
        </mx:Script>
    
        <mx:Style>
            @font-face{
                src: url("./fonts/base02.ttf");
                fontFamily: "Base02";
            }
    
            .myButtonStyle {
                embedFonts: true;
                fontFamily: Base02;
                fontWeight: normal;
                fontSize: 24;
                cornerRadius: 0;
                letterSpacing: 4;
                textRollOverColor: red;
                skin: ClassReference(null);
                icon: Embed(source="./assets/iconInstall.png");
            }
        </mx:Style>
    
        <mx:ApplicationControlBar id="applicationControlBar" dock="true">
            <mx:Label id="info" text="{fileName} ({fileSize}kb)" />
        </mx:ApplicationControlBar>
    
        <mx:Button id="btn" label="{btn.getStyle('fontFamily')}" styleName="myButtonStyle" />
    
    </mx:Application>
    

    View source is enabled in the following example.

    I didn’t include the TrueType font in the source code ZIP. If you want to grab that exact font, head over to the creator’s site @ http://www.stereo-type.net/ and download “Base 02″.

    转载:http://blog.flexexamples.com/2007/08/28/styling-a-flex-button-control-using-embedded-fonts/

  • 相关阅读:
    Day3-B-Round Marriage CodeForces-981F
    Day3-A-Problem H. Monster Hunter HDU6326
    Day3-G
    Day3-I-Squares POJ2002
    Day3-M-Cable master POJ1064
    Day3-N
    Day3-O-Median POJ3579
    Day3-P
    Day3-L-Cup HDU2289
    LeetCode "Majority Element"
  • 原文地址:https://www.cnblogs.com/wuhenke/p/1665863.html
Copyright © 2011-2022 走看看