佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1039|回复: 7

[求助]Flash音乐的action scrpt

[复制链接]
发表于 14-11-2004 06:36 PM | 显示全部楼层 |阅读模式
  1. onLoad = function () {
  2. s = new Sound();
  3. s.attachSound("eternity");
  4. s.setVolume(200);
  5. s.start(0, 999);
  6. };
复制代码

请问能不能让以上的eternity(s)播完后不播回同样的歌呢?我要放另外一首。
回复

使用道具 举报


ADVERTISEMENT

发表于 15-11-2004 12:41 AM | 显示全部楼层
blue5 于 14-11-2004 06:36 PM  说 :
  1. onLoad = function () {
  2. s = new Sound();
  3. s.attachSound("eternity");
  4. s.setVolume(200);
  5. s.start(0, 999);
  6. };
复制代码

请问能不能让以上的eternity(s)播完后不播回同样的歌呢?我要放另外 ...


  1. var bgm:Object = new Object();
  2. bgm.snd = new Sound();
  3. bgm.snd.master = bgm;
  4. //
  5. bgm.playN = 0;
  6. bgm.playLoop = 0;
  7. bgm.list = new Array();
  8. //
  9. bgm.snd.onSoundComplete = function() {
  10.         this.master.playNext();
  11. };
  12. //
  13. bgm.playNext = function() {
  14.         this.playN++;
  15.         if (this.playN >= this.list.length) {
  16.                 this.playN = 0;
  17.         }
  18.         //
  19.         this.play(this.playN, this.playLoop);
  20. };
  21. bgm.play = function(song:Number, loop:Number) {
  22.         this.snd.stop();
  23.         var tmp:Number = Math.max(0, Math.min(song, this.list.length - 1));
  24.         this.playN = tmp;
  25.         this.playLoop = loop;
  26.         this.snd.attachSound(this.list[tmp]);
  27.         this.snd.start(0, loop);
  28. };
  29. bgm.stop = function() {
  30.         this.snd.stop();
  31. };
复制代码

//增加音乐(linkage exported)到 playList
bgm.list.push("song_001");
bgm.list.push("song_002");
bgm.list.push("song_003");
bgm.list.push("song_004");
bgm.list.push("song_005");
//从第一首开始播放,每首连续播 10 次
bgm.play(0, 10);


这里是一个简单的做法,
建议修改一些,改成 AS 2.0 的 class,日后用起来更方便。
回复

使用道具 举报

 楼主| 发表于 15-11-2004 02:19 PM | 显示全部楼层
哇,好复杂,嗯。。。。。看来只好用回一首歌了。。。因为之后的as在换了复杂的sound object过后我就不会改了。谢谢你。。。
回复

使用道具 举报

发表于 15-11-2004 02:25 PM | 显示全部楼层
要学就不要怕复杂嘛!这样怎么可能学会呢?
回复

使用道具 举报

发表于 15-11-2004 10:36 PM | 显示全部楼层
blue5 于 15-11-2004 02:19 PM  说 :
哇,好复杂,嗯。。。。。看来只好用回一首歌了。。。因为之后的as在换了复杂的sound object过后我就不会改了。谢谢你。。。

hmmm.....
直接套用就行了呀……
回复

使用道具 举报

 楼主| 发表于 15-11-2004 11:27 PM | 显示全部楼层
emilccp 于 15-11-2004 02:25 PM  说 :
要学就不要怕复杂嘛!这样怎么可能学会呢?

说的也是,但是我怕待会弄乱了。。。比如说我要在loadmovie后把background music停止,那么variable是bgm吧?是不是set _level0.bgm.stop();呢?然后能不能每首歌播一次,播完全部五首然后再从复?
回复

使用道具 举报

Follow Us
发表于 16-11-2004 01:02 PM | 显示全部楼层
blue5 于 15-11-2004 11:27 PM  说 :

说的也是,但是我怕待会弄乱了。。。比如说我要在loadmovie后把background music停止,那么variable是bgm吧?是不是set _level0.bgm.stop();呢?然后能不能每首歌播一次,播完全部五首然后再从复?

bgm.play(0, 0);

就行了
回复

使用道具 举报

 楼主| 发表于 16-11-2004 06:33 PM | 显示全部楼层
谢谢你哦,迟些我式一下。。。
回复

使用道具 举报


ADVERTISEMENT

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 28-5-2024 10:15 PM , Processed in 0.061111 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表