使用外部 CSS 来设置 Flash MX 2004 组件外观

王朝html/css/js·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

While working on a project at Schematic, I was investigating the possibility of defining style attributes for component instances in an external CSS file. I got the following system to work:

1. Create an external CSS file, defining the style(s) and component-specific styles you want to customize. For example:

/* Filename: styles.css */

checkbox {

color: 0x0000FF;

embedFonts: false;

fontFamily: Arial;

fontSize: 24;

}

2. Load the style sheet into your Flash movie, retrieve the style name, and apply it to your instance:

import mx.controls.CheckBox;

var oStyle:Object;

var ccbTest:mx.controls.CheckBox;

var styles = new TextField.StyleSheet();

styles.onLoad = function(bSuccess:Boolean):Void {

if (bSucess) {

oStyle = this.getStyle("checkbox");

for(var i in oStyle){

ccbTest.setStyle(i, oStyle[i]);

}

} else {

trace("Error loading CSS file.");

}

};

styles.load("styles.css");

--From (http://blogs.flashsupport.com/robert/archive/2004/09/08/209.aspx)

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航