1.新建壹個影片剪輯元件,導入音樂。
2.回到場景,插入三個圖層,從公用庫把兩個按鈕拖入舞臺,第三個圖層,把影片剪輯裏的音樂拖入舞臺。如圖:
給開始按鈕實例名:ks_mc?如圖:
如此類推,給暫停寫實例名:tz_mc?給音樂寫實例名:yp_mc
3.再建個圖層,命名as,幀裏寫代碼:
tz_mc.onRollOut?=?function?()
{
tz_mc.gotoAndStop(1);
};
tz_mc.onRollOver?=?function?()
{
tz_mc.gotoAndStop(2);
};
tz_mc.onPress?=?function?()
{
tz_mc.gotoAndStop(3);
};
tz_mc.onRelease?=?function?()
{
tz_mc.gotoAndStop(1);
yp_mc.stop();
};
ks_mc.onRollOut?=?function?()
{
ks_mc.gotoAndStop(1);
};
ks_mc.onRollOver?=?function?()
{
ks_mc.gotoAndStop(2);
};
ks_mc.onPress?=?function?()
{
ks_mc.gotoAndStop(3);
};
ks_mc.onRelease?=?function?()
{
ks_mc.gotoAndStop(1);
yp_mc.play();
};
Ok,試試吧~