发信人: lyongmei1977(晨峰)
整理人: lyongmei1977(2002-06-29 23:09:44), 站内信件
|
Flash5导入外部文本新方法
用#include可以方便的导入外部文本。
语法
#include "filename.as";
参数
filename.as 要包含的文件名; .as 是推荐的文件扩展名.
filename.as这个文件的格式,完全按照编写action的格式就行,就象在flash中用专家模式输入一样。现以一例说明具体步骤。
1、编辑txt.as内容如下:
txt = "这是用include导入的文本";
2、新建include.fla,在第1帧加上action: #include "txt.as"
3、在场景中建一动态文本框(Window->Panels->Text Options中,选Dynamic Text),变量名(Variable)中输入_root.txt
Publish后,保证include.swf和txt.as在同一目录,运行include.swf就可以了。
更高级的应用:数组
txt.as的内容可以这样编辑:
words_array=[];
words_array[0]=["aaa","bbb"];
words_array[1]=["ccc","ddd"];
words_array[2]=["eee","fff"];
你可以方便准确的调用数组中的任一个元素,如words_array[0][1]就调用了"bbb"。并且你可以随时给这个数组添加元素而不用改动fla文件。
---- ▇▇▇▇▇▇▇▇
■ Flash 闪客 ■
■ 版 ★ 副 ■
■ 专用章 ■
▇▇▇▇▇▇▇▇
Email: [email protected]
联系QQ:103686198 |
|