**หน้านี้ผมจะเขียนเฉพาะ เรื่องเวลาและ attach sound ส่วนการปรับเสียงผมเคยเขียนไว้แล้ว จะไม่เขียนอีก เพราะสามารถประยุกต์เข้ากันได้ music ตัวนี้ ยาวประมาณ 1.47 นาที**
1.ทำปุ่ม button มาสองปุ่มคือ ปุ่มเปิดและปุ่มปิด
ปุ่มเปิดใส่ script ดังนี้
on (release) {
if (!playmusic) {
music.start(segment/1000, 1);
temptimer = getTimer();
playmusic = true;
}
}
ปุ่มปิดใส่ดังนี้
on (release) {
stopAllSounds ();
gotoAndPlay (1);
}
2.เมาส์คลิ๊กที่ tools เลือกตัวอักษรนำมาลากให้พอดี ปรับตรง text option ให้เป็น dynamic text เสร็จแล้วคลิ๊กเลือก กด f8 เลือกเป็น movie clip ใส่ชื่อตรง name ว่า timer
2.1.double click ตรงที่ mc ชื่อ timer เมาส์คลิ๊กที่ เฟรม2 กด f6
ที่เฟรมแรกใส่ script ดังนี้

ปรับตรง text option ดังภาพ

2.2.เฟรม2ใส่ script ดังนี้
gotoAndPlay(1);
ปรับ text option ให้เป็น dynamic text,single line ตรง variable ใส่ชื่อว่า timer
3.ให้ import sound เข้ามา ไปที่ libray เมาส์คลิ๊กที่ sound คลิ๊กขวามือ เลือก linkage เลือก Export this symbol ตรง identifier ใส่ชื่อตามที่คุณต้องการ (ของผมเป็น amazing)
4.ที่ scene1 layer2
เฟรมแรก ใส่ script ดังนี้
music = new Sound();
music.attachSound("amazing");(ชื่อ sound ที่เราตั้งไว้ ใน linkage)
segment = 0; playmusic = false;
temptimer = 0;
musiclength = 888200;(ความยาว ของ sound ให้กำหนดตั้งค่าเอาเอง)
timer.timer = 0;
เฟรม2 ใส่ script ดังนี้
stop ();
5.ctrl+enter

งาช้างไม่เคยงอกออกจากปากหมา Ivory does not grow in the mouth of a dog.
Hosted by www.Geocities.ws

1