作者salas (工設超人)
看板Flash
標題[問題] 請問關於隨機音樂該怎麼寫?
時間Tue May 25 16:53:59 2010
我是只會gotoandplay的新手
我咕狗到很多可是都是從外面連結的
我是要從元件庫的,請問該怎麼寫?
我希望按鈕按下播放s1-s11亂數音效
感謝板上先進不吝賜教
我使用的是as2
感激不盡
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.204.114.160
1F:推 etrexetrex:把s1到s11作成元件 元件的圖層裡面放音效 05/25 16:57
2F:→ aquarianboy:trace("s" + (random(11)+1)); 05/25 16:57
3F:→ etrexetrex:然後把元件拉出來放到場景上 05/25 16:58
4F:→ etrexetrex:as寫 this["s" + (random(11)+1)].gotoAndPlay(1); 05/25 16:59
5F:→ etrexetrex:我程式是直接抄版主的XD 05/25 16:59
6F:→ salas:阿?認真嗎,我以為是直接寫在影格上就KO了.... 05/25 16:59
7F:→ etrexetrex:剛忘了講元件拉出來之後要命名 05/25 16:59
8F:→ etrexetrex:蛤 可是你只會 gotoAndPlay 這是配合你的作法 05/25 17:00
9F:→ salas:賣安內啦 我很認真耶ˊˋ 05/25 17:01
10F:→ aquarianboy:其實我覺得etrex回得還滿認真的說 05/25 17:02
11F:推 etrexetrex:講認真的 我說的作法 是最簡單的 05/25 17:02
12F:→ salas:as是寫在元件裡嗎 05/25 17:04
13F:→ salas:不是啦...我意思是說我有好多個按鈕我要點每下聲音都不一樣 05/25 17:10
14F:推 etrexetrex:AS寫在場景影格 05/25 17:22
15F:→ salas:可是把元件丟在影格上就會一起叫了耶 05/25 17:37
16F:→ salas: 場景 05/25 17:38
17F:→ sextitanic:不然弄個影片片段元件,第 1 格空白設 stop(); 05/25 17:44
18F:→ sextitanic:第 2 格之後才放聲音,按按鈕之後再照版大的寫法播放 05/25 17:45
19F:推 etrexetrex:喔 對呀 忘記說元件作好第一影格要寫stop(); 05/25 18:21
20F:→ salas:歐不.....cant work 05/25 18:21
21F:→ salas:好奇怪問題再不能貼音樂.... 05/25 21:19
22F:→ sextitanic:把影格設長一點,應該就會發現時間軸上面會有音浪 05/26 00:45
23F:→ sextitanic:太強~~不晃會被撞到地上~~ 05/26 00:45