home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / pepsi_pinball.swf / scripts / frame_8 / DoAction_3.as < prev    next >
Encoding:
Text File  |  2006-05-18  |  3.4 KB  |  115 lines

  1. function initSounds()
  2. {
  3.    _root.createEmptyMovieClip("soundHolder",25000);
  4.    soundDepth = 0;
  5.    createSound("B_can.wav","B_can_snd");
  6.    createSound("B_extraBall.wav","B_extraBall_snd");
  7.    createSound("B_lose.wav","B_lose_snd");
  8.    createSound("B_stool.wav","B_stool_snd");
  9.    createSound("B_win.wav","B_win_snd");
  10.    createSound("M_ballThud.wav","M_ballThud_snd");
  11.    createSound("M_barrel.wav","M_barrel_snd");
  12.    createSound("M_bumper.wav","M_bumper_snd");
  13.    createSound("M_cart1.wav","M_cart1_snd");
  14.    createSound("M_cart2.wav","M_cart2_snd");
  15.    createSound("M_cart3.wav","M_cart3_snd");
  16.    createSound("M_cart4.wav","M_cart4_snd");
  17.    createSound("M_cart5.wav","M_cart5_snd");
  18.    createSound("M_ding.wav","M_ding_snd");
  19.    createSound("M_flipper.wav","M_flipper_snd");
  20.    createSound("M_horse.wav","M_horse_snd");
  21.    createSound("M_launchNewBall.wav","M_launchNewBall_snd");
  22.    createSound("M_mainRamp.wav","M_mainRamp_snd");
  23.    createSound("M_rampBallKicked.wav","M_rampBallKicked_snd");
  24.    createSound("M_rampThud.wav","M_rampThud_snd");
  25.    createSound("M_saloonDoor.wav","M_saloonDoor_snd");
  26.    createSound("M_scoreTotal.wav","M_scoreTotal_snd");
  27.    createSound("M_scream.wav","M_scream_snd");
  28.    createSound("M_target.wav","M_target_snd");
  29.    createSound("M_wolf.wav","M_wolf_snd");
  30.    createSound("T_musicFinalTheme.wav","T_musicFinalTheme_snd");
  31.    createSound("T_musicIntro.wav","T_musicIntro_snd");
  32.    createSound("T_musicMainTheme.wav","T_musicMainTheme_snd");
  33.    B_can_snd.setVolume(100);
  34.    B_extraBall_snd.setVolume(80);
  35.    B_lose_snd.setVolume(100);
  36.    B_stool_snd.setVolume(80);
  37.    B_win_snd.setVolume(100);
  38.    M_ballThud_snd.setVolume(50);
  39.    M_barrel_snd.setVolume(50);
  40.    M_bumper_snd.setVolume(50);
  41.    M_cart1_snd.setVolume(100);
  42.    M_cart2_snd.setVolume(100);
  43.    M_cart3_snd.setVolume(100);
  44.    M_cart4_snd.setVolume(100);
  45.    M_cart5_snd.setVolume(100);
  46.    M_ding_snd.setVolume(80);
  47.    M_flipper_snd.setVolume(50);
  48.    M_horse_snd.setVolume(80);
  49.    M_launchNewBall_snd.setVolume(60);
  50.    M_mainRamp_snd.setVolume(60);
  51.    M_rampBallKicked_snd.setVolume(60);
  52.    M_rampThud_snd.setVolume(80);
  53.    M_saloonDoor_snd.setVolume(100);
  54.    M_scoreTotal_snd.setVolume(80);
  55.    M_target_snd.setVolume(60);
  56.    T_musicFinalTheme_snd.setVolume(100);
  57.    T_musicIntro_snd.setVolume(100);
  58.    T_musicMainTheme_snd.setVolume(100);
  59.    cartSoundArr = new Array(M_cart1_snd,M_cart2_snd,M_cart3_snd,M_cart4_snd,M_cart5_snd);
  60. }
  61. function createSound(id, name)
  62. {
  63.    soundDepth++;
  64.    instName = "sound" + soundDepth + "_mc";
  65.    soundHolder.createEmptyMovieClip(instName,soundDepth);
  66.    var mc = soundHolder[instName];
  67.    _root[name] = new Sound(mc);
  68.    _root[name].attachSound(id);
  69. }
  70. function playSound(snd)
  71. {
  72.    if(soundOn)
  73.    {
  74.       snd.start();
  75.    }
  76. }
  77. function playSoundLoop(snd)
  78. {
  79.    if(soundOn)
  80.    {
  81.       snd.start(0,1000);
  82.    }
  83. }
  84. function playSoundVolume(snd, volume)
  85. {
  86.    if(soundOn)
  87.    {
  88.       snd.setVolume(volume);
  89.       snd.start();
  90.    }
  91. }
  92. function stopSound(snd)
  93. {
  94.    snd.stop();
  95. }
  96. function fadeSound(snd)
  97. {
  98.    fader.snd = snd;
  99.    fader.gotoAndPlay("start");
  100. }
  101. function calculateVolume(velocity)
  102. {
  103.    var volume = Math.floor(dist(0,0,velocity.x,velocity.y) * 100 / maxSpeed);
  104.    if(volume > 100)
  105.    {
  106.       volume = 100;
  107.    }
  108.    return volume;
  109. }
  110. initSounds();
  111. stopSound(T_musicFinalTheme_snd);
  112. stopSound(T_musicIntro_snd);
  113. stopSound(T_musicMainTheme_snd);
  114. musicIntro_snd.stop();
  115.