goback add

在Flash动态文本框中加载HTML格式文本

3720 点击·0 回帖
灯火互联
楼主
在Flash中可以利用Actionscript在动态文本框中加载HTML格式的文本,下面我们介绍具体方法。这里就不给大家具体讲解HTML标记了,如果您不熟悉可以查看天极设计在线的网页设计基础知识。
  完成效果如下:


  建立一个Flash文档,然后设置如下字体。
  在上面图示中如果你没有设置多行、将文本呈现为HTML两项,那么我们可以使用下面代码:
myText.html = true;
myText.multiline = true;

  然后设置HTML格式文档。
myHTMLdata= This is a bold text
And this text is in Italic
This is a href="linkhttp://desigm.yesky.com">link> to the bbc website.
Here is a little list of colors :
Red Green BlueHere is a little image that links to the bbc site href="linkhttp://desigm.yesky.com"> src="bird.jpg">
  把上面内容存为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动画放在同一个目录下。

喜欢0 评分0