หน้าแรก > Flash > มา Freeze จับเวลา Flash กันดีกว่า

มา Freeze จับเวลา Flash กันดีกว่า

อีกวิธีหนึ่งที่เราต้องการจับเวลา Flash โดยที่ไม่จำเป็นต้องเพิ่ม timeline ให้ยืดยาวววววววววววววววววววววว
ทริคก็คือ การเขียน function จับเวลา ณ จุดที่เราต้องการแช่ animation ไว้นั่นเอง

วิธีการ
1) ทำ animation flash ให้เรียบร้อย
2) ณ จุดที่ต้องการแช่ animation ให้ใส่คำสั่งที่ frame ดังนี้

stop();
function ชื่อฟังค์ชั่น (){
clearInterval(id);
gotoAndPlay(‘เฟรมที่ต้องการให้เล่นถัดไป’);
}

var id = setInterval(ชื่อฟังค์ชั่น,จำนวนวินาทีที่ต้องการหยุดค้าง x 1000);

ตัวอย่าง function
stop();
function auto (){
clearInterval(id);
gotoAndPlay(‘shot2′);
}

var id = setInterval(auto,3000);

เอาไปลองใช้กันดูนะค้าาา ถ้าติดตรงไหนมาเล่าสู่กันฟังเหมือนเดิมน้าาาา

Categories: Flash
  1. ยังไม่มีความเห็น
  1. No trackbacks yet.

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Connecting to %s

Follow

Get every new post delivered to your Inbox.