作者cort38 (cort38)
看板Flash
标题Re: [问题] 关於打字音效的控制
时间Thu Feb 15 19:37:52 2007
很简单的改写一下你的程式,把程式写在一个frame上就好
用function去执行就好,这样你看应该会简单很多
在第一个frame上:
function typeTxt(){
count=0;
myid=setInterval(typeRun,200);
}
function typeRun(){
if(count<mystr.length){
count++;
_root.showtxt=mystr.substr(0,count);
mySound.start();
}else{
clearInterval(myid);
}
}
mystr="1234567890abcdefghij";
mySound=new Sound();
mySound.attachSound("soundId");//这里soundId就是在library里声音物件的likage名
称
在你要触发的地方呼叫函式就可以了,譬如说在按钮上
on(release){
typeTxt();
}
这样写,你连打字的速度都可自行调整
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 124.10.51.237