文字像打字机出现效果实现

      flash資源 2005-2-26 14:5
以下简述文字实现打字机出现效果

1、在帧上面加入以下动作:
var i = -1;
_root.createTextField("m_txt", 0, 20, 200, 500, 40);
var my_lv = new LoadVars();
my_lv.onLoad = function(success) {
    if (success) {
        trace(my_lv.temp);
        run();
    } else {
        stop();
    }
};
my_lv.load("1.txt");
function run() {
    onEnterFrame = function () {
        if (++i<=my_lv.temp.length) {
            m_temp = my_lv.temp.substr(i, 1);
            m_txt.text += m_temp;
        } else {
            delete onEnterFrame;
        }
    };
}
System.useCodepage = true;


2、在文件外新建一记事本,命名为1.txt并保存
在记录本中加入以下内容temp=*******,temp后面接的内容即为需要出现的字,如:
temp=asdfklasdfasdfasf
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}