2004/09/13 | 关于css样式的外部导入和XML的使用方法
类别(Other) | 评论(0) | 阅读(358) | 发表于 09:57
myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.label.condenseWhite = true;
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("kungfu.css");
myText.styleSheet = kungFuStyle;
kungFuContent = new XML();
kungFuContent.ignoreWhite = true;
kungFuContent.load("kungfu.xml");
kungFuContent.onLoad = function(success) {
    if (success) {
        myText.text = kungFuContent;
    }
};
----------------------------
kungfu.css:
drunken {
color: #FF0000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
display: inline;
}
monkey {
color: #0000FF;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
display: inline;
}
.snake {
color: #00FF00;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
display: inline;
}
--------------------
kungfu.xml:
<?xml version="1.0" encoding="gb2312"?>
<kungfu>
    <drunken>This is some drunken text</drunken>
    <monkey>This is some monkey text</monkey>
    <snake>This is some snake text</snake>
    <dragon>This is some dragon text</dragon>
</kungfu>
0

评论Comments

日志分类
首页[185]
Flash[123]
ColdFusion[2]
Flex[2]
FlashMedia[3]
RIA[4]
Other[43]
Python[0]
Design[8]