flash 載入 html 和CSS

來源:互聯網
上載者:User

 

flash 載入 html 和CSSAS代碼:

情境內添加一個動態文字框名為:loadtxt_css

建立層寫入如下代碼:

var loadtxt_css:TextField.StyleSheet = new TextField.StyleSheet();

//定義 loadtxt_css 為樣式建構函式

loadtxt_css.load("css.css");

//載入預先定義好的 css樣式檔案

loadtxt.styleSheet = loadtxt_css;

//動態文字框 樣式 預設為載入進來的 樣式

loadtxt.multiline = true;

//允許多行顯示

loadtxt.wordWrap = true;

//支援分行符號

loadtxt.html = true;

//支援 html

var loadtxt_html:XML = new XML();

//定義loadtxt_html 為內部xml (用來裝載外部檔案)

loadtxt_html.ignoreWhite = true;

//忽略空格

loadtxt_html.load("html.html");

//載入html檔案

loadtxt_html.onLoad = function()

{

loadtxt.htmlText = loadtxt_html;

//賦予動態文字框 載入進來的html

};

//成功

------------------------------------------------------------------------------------------------------------------------

CSS代碼:

與flash檔案同檔案夾建立一個 css.css 檔案:

代碼如下:

mainBody {

font-family: "宋體";

color:#666666;

font-size: 12px;

}

biline {

font-family:"宋體";

color:#666666;

font-size: 12px;

font-style: italic;

}

A {

font-family:"宋體";

color:#666666;

font-size: 12px;

display: inline;

text-decoration:underline;

}

a:hover {

font-family: "宋體";

color: #0077D5;

}

.STYLE2 {

color: #333333;

font-family: "宋體";

font-size: 12pt;

}

.STYLE4 {color: #FF3300;}

a:link {

color: #666666;

text-decoration: none;

}

a:visited {

text-decoration: none;

}

------------------------------------------------------------------------------------------------------------------------

html代碼:

與flash檔案同檔案夾建立一個 html.html檔案:

代碼如下:

<style type="text/css">

</style><body>

<toBody ><span class="STYLE4">熱門關鍵字:</span> <a href="http://www.baidu.com" target="_blank">舞林大會</a> | <a href="http://www.google.com">海珊</a> | 雅閣女 | 名聲大震 | 蔡依林 | 自拍彩的視頻期待您的關注!</toBody >

</body>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.