整个flash只用两桢,第一桢用与控制打字和控制,第2桢为清除桢,清除按钮的动作负责跳转回第1桢。
第一桢:
stop();
var mySting:String = "这是个文字打字效果,文字打字效果主要用到的是动态文本结合相关as脚本代码实现,2008年12月3日";
var em:Number = 0;//
var txt:String = "";
var mytime:Date = new Date();
var mySound:Sound = new Sound();//定义打字效果的声音,无须在属性面板设置声音。
function 打字效果(t) {
onEnterFrame = function () {
mySound.attachSound("sound");
newtime = new Date();
时间差 = (newtime-mytime)/1000;//打字时间差
if (时间差>=t) {
mytime = new Date();
mySound.start(0, 1);
txt += mySting.substr(em, 1);//当前文字字符
em++;
if (em>=mySting.length) {
delete onEnterFrame;
}
}
};
}
第2桢:
stop();
停止影片的重复播放。
0 Response to “Flash动态文本打字效果”