在cf7.0.1,cfform多了个onload属性,这样我们就可以在cfform导入前设置全局的CSS来设置所有cfform的外观,具体global css的用法请参考flex文档

在cf7.0.1,cfform多了个onload属性,这样我们就可以在cfform导入前设置全局的CSS来设置所有cfform的外观,具体global css的用法请参考flex文档,例子如下:


<cfform name="myform" height="400" width="280" format="Flash" onload="formOnLoad()">
<cfformitem type="script">
    function formOnLoad()
    {
       // Do anything that you need to do in the onload Event
       // call the function that is in charge of applying the styles  applyStyles();
    }
    function applyStyles()
    {
        _global.styles.CheckBox.setStyle("fillColors", [0x006699, 0xffffff]);
        _global.styles.RadioButton.setStyle("fillColors", [0x006699, 0xffffff]);
        _global.styles.Form.setStyle("color", 0x000000);
        _global.styles.Button.setStyle("borderThickness", 1);
        _global.styles.Panel.setStyle("backgroundColor", 0xE5F0F9);
        _global.styles.Panel.setStyle("color", 0xffffff);
        _global.styles.Panel.setStyle("headerColors", [0x277DC6,0x50ABF7]);
        _global.styles.HBox.setStyle("backgroundColor", 0x006699);
        _global.styles.HBox.setStyle("marginTop", 10);
        _global.styles.HBox.setStyle("marginBottom", 10);
        _global.styles.HBox.setStyle("marginLeft", 10);
        _global.styles.Accordion.setStyle("fillColors", [0x277DC6,0x50ABF7]);
        _global.styles.Accordion.setStyle("fillColors", [0x277DC6,0x50ABF7]);
        _global.styles.Accordion.setStyle("selectedFillColors", [0xff6600,0xffcc00]);
        _global.styles.Accordion.setStyle("themeColor", 0x0066cc);
        _global.styles.Accordion.setStyle("color", 0x0ffffff);
        _global.styles.TextArea.setStyle("fontSize",14);
        _global.styles.TextInput.setStyle("fontSize",9);

    }
 </cfformitem>
<cfformgroup type="hBox">
    <cfformgroup type="panel" width="240" label="Panel">
         <cfformgroup type="accordion" width="210" height="300" label="Containers">
              <cfformgroup type="page" label="Inputs">
                <cfinput type="text" width="100" label="Input" name="inputText" value="Some small text"/>
                 <cfinput type="password" width="100" label="Password" name="password" />
                 <cfinput type="dateField" width="100" label="Date Field" name="inputDate" />
                <cftextarea type="text" name="displayText" label="TextArea" width="100" height="100" >Some large text</cftextarea>
             </cfformgroup>
             <cfformgroup type="page" label="Buttons, CheckBoxes, Radios">
                <cfformitem type="text" width="175">Check Box</cfformitem>
                <cfinput type="checkBox" label="Check me" name="inputCB" />
                <cfformitem type="text" width="175">Radio Buttons</cfformitem>
                <cfinput type="radio" label="Yes" checked="true" name="radiobutton" value="y" />
                 <cfinput type="radio" label="No" name="radiobutton" value="n" />
                 <cfinput type="button" name="mybutton" value="Button" />
              </cfformgroup>
              <cfformgroup type="page" label="Calendar">
                   <cfcalendar name="myCalendar" label="Calendar"></cfcalendar>
              </cfformgroup>
          </cfformgroup>
    </cfformgroup>
 </cfformgroup>
</cfform>

查看示例

下载代码

查看原文