1 FL 教程Flash 動態文本框中加載HTML格式文本 周四 3月 03, 2011 8:15 pm
Admin
Admin
在Flash中可以利用Actionscript在動態文本框中加載HTML格式的文本,下面我們介紹具體方法。這里就不給大家具體講解HTML標記了,假如您不熟悉可以查看天極設計在線的網頁設計基礎知識。
完成效果如下:
建立一個Flash文檔,然后設置如下字體。
在上面圖示中假如你沒有設置多行、將文本呈現為HTML兩項,那么我們可以使用下面代碼:
myText.html = true;
myText.multiline = true;
然后設置HTML格式文檔。 myHTMLdata=<p><b>This is a bold
text</b></p><p><i>And this text is in
Italic</i></p>This is a <a href="[您必需注冊并登錄才能查看本鏈接。]>
to the bbc website.<br>Here is a little list of colors
:<br><li><font
color="#FF0000">Red</font></li><li><font
color="#009900">Green</font></li><li><font
color="#0000FF">Blue</font></li>Here is a little image
that links to the bbc site<a href="[您必需注冊并登錄才能查看本鏈接。]"><img src="bird.jpg"></a>
把上面內容存為myHTML.txt。
3、新添加圖層,選擇第一幀,按F9輸入如下指令:
myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
// the data is loaded in the myLoadVars object as a property of the object
myText.htmlText = myLoadVars.myHTMLdata;
}
myLoadVars.load("myHTML.txt");
現在可以測試一下了。注重!一定要把myHTML.txt、bird.jpg和Flash動畫放在同一個目錄下。]
完成效果如下:
建立一個Flash文檔,然后設置如下字體。
在上面圖示中假如你沒有設置多行、將文本呈現為HTML兩項,那么我們可以使用下面代碼:
myText.html = true;
myText.multiline = true;
然后設置HTML格式文檔。 myHTMLdata=<p><b>This is a bold
text</b></p><p><i>And this text is in
Italic</i></p>This is a <a href="[您必需注冊并登錄才能查看本鏈接。]>
to the bbc website.<br>Here is a little list of colors
:<br><li><font
color="#FF0000">Red</font></li><li><font
color="#009900">Green</font></li><li><font
color="#0000FF">Blue</font></li>Here is a little image
that links to the bbc site<a href="[您必需注冊并登錄才能查看本鏈接。]"><img src="bird.jpg"></a>
把上面內容存為myHTML.txt。
3、新添加圖層,選擇第一幀,按F9輸入如下指令:
myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
// the data is loaded in the myLoadVars object as a property of the object
myText.htmlText = myLoadVars.myHTMLdata;
}
myLoadVars.load("myHTML.txt");
現在可以測試一下了。注重!一定要把myHTML.txt、bird.jpg和Flash動畫放在同一個目錄下。]