Advertisement
Braber01

Sound not Stoping after soundChannel.stop() has been Called

Jun 30th, 2011
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.media.Sound;
  2. stop();
  3. var soundClip:Sound;
  4. var soundChannel:SoundChannel = new SoundChannel();
  5. function init():void {
  6.     soundClip = new Sound();
  7.     soundClip.load(new URLRequest(".\\Wheel of Fortune.mp3"));
  8.     soundClip.addEventListener(Event.COMPLETE,soundLoaded);
  9. }//end init()
  10.  
  11. init();
  12.  
  13. function soundLoaded(e:Event):void {
  14.     soundChannel = soundClip.play();
  15. }//end soundLoaded
  16.  
  17. //txtWheel.text = "";
  18. //this.aussie_btn.addEventListener(MouseEvent.MOUSE_OVER,aussieMouseOver);
  19. //this.aussie_btn.addEventListener(MouseEvent.MOUSE_OUT,aussieMouseOut);
  20. this.aussie_btn.addEventListener(MouseEvent.ROLL_OVER,aussieMouseOver);
  21. this.aussie_btn.addEventListener(MouseEvent.ROLL_OUT,aussieMouseOut);
  22. this.aussie_btn.addEventListener(MouseEvent.CLICK,aussieClick);
  23.  
  24. //this.bigMoney_btn.addEventListener(MouseEvent.MOUSE_OVER,moneyMouseOver);
  25. //this.bigMoney_btn.addEventListener(MouseEvent.MOUSE_OUT,moneyMouseOut);
  26. this.bigMoney_btn.addEventListener(MouseEvent.ROLL_OVER,moneyMouseOver);
  27. this.bigMoney_btn.addEventListener(MouseEvent.ROLL_OUT,moneyMouseOut);
  28. this.bigMoney_btn.addEventListener(MouseEvent.CLICK,moneyClick);
  29.  
  30. //this.finland_btn.addEventListener(MouseEvent.MOUSE_OVER,finlandMouseOver);
  31. //this.finland_btn.addEventListener(MouseEvent.MOUSE_OUT,finlandMouseOut);
  32. this.finland_btn.addEventListener(MouseEvent.ROLL_OVER,finlandMouseOver);
  33. this.finland_btn.addEventListener(MouseEvent.ROLL_OUT,finlandMouseOut);
  34. this.finland_btn.addEventListener(MouseEvent.CLICK,finlandClick);
  35.  
  36.  
  37. //this.gameboy_btn.addEventListener(MouseEvent.MOUSE_OVER,gameboyMouseOver);
  38. //this.gameboy_btn.addEventListener(MouseEvent.MOUSE_OUT,gameboyMouseOut);
  39. this.gameboy_btn.addEventListener(MouseEvent.ROLL_OVER,gameboyMouseOver);
  40. this.gameboy_btn.addEventListener(MouseEvent.ROLL_OUT,gameboyMouseOut);
  41. this.gameboy_btn.addEventListener(MouseEvent.CLICK,gameboyClick);
  42.  
  43. //this.nes_btn.addEventListener(MouseEvent.MOUSE_OVER,nesMouseOver);
  44. //this.nes_btn.addEventListener(MouseEvent.MOUSE_OUT,nesMouseOut);
  45. this.nes_btn.addEventListener(MouseEvent.ROLL_OVER,nesMouseOver);
  46. this.nes_btn.addEventListener(MouseEvent.ROLL_OUT,nesMouseOut);
  47. this.nes_btn.addEventListener(MouseEvent.CLICK,nesClick);
  48.  
  49. //this.phillipine_btn.addEventListener(MouseEvent.MOUSE_OVER,phillipneMouseOver);
  50. //this.phillipine_btn.addEventListener(MouseEvent.MOUSE_OUT,phillipneMouseOut);
  51. this.phillipine_btn.addEventListener(MouseEvent.ROLL_OVER,phillipneMouseOver);
  52. this.phillipine_btn.addEventListener(MouseEvent.ROLL_OUT,phillipneMouseOut);
  53. this.phillipine_btn.addEventListener(MouseEvent.CLICK,phillipneClick);
  54.  
  55. //this.french_btn.addEventListener(MouseEvent.MOUSE_OVER,frenchMouseOver);
  56. //this.french_btn.addEventListener(MouseEvent.MOUSE_OUT,frenchMouseOut);
  57. this.french_btn.addEventListener(MouseEvent.ROLL_OVER,frenchMouseOver);
  58. this.french_btn.addEventListener(MouseEvent.ROLL_OUT,frenchMouseOut);
  59. this.french_btn.addEventListener(MouseEvent.CLICK,frenchClick);
  60.  
  61. //this.turnTable_btn.addEventListener(MouseEvent.MOUSE_OVER,turntableMouseOver);
  62. //this.turnTable_btn.addEventListener(MouseEvent.MOUSE_OUT,turntableMouseOut);
  63. this.turnTable_btn.addEventListener(MouseEvent.ROLL_OVER,turntableMouseOver);
  64. this.turnTable_btn.addEventListener(MouseEvent.ROLL_OUT,turntableMouseOut);
  65. this.turnTable_btn.addEventListener(MouseEvent.CLICK,turntableClick);
  66.  
  67. //this.uk_btn.addEventListener(MouseEvent.MOUSE_OVER,ukMouseOver);
  68. //this.uk_btn.addEventListener(MouseEvent.MOUSE_OUT,ukMouseOut);
  69. this.uk_btn.addEventListener(MouseEvent.ROLL_OVER,ukMouseOver);
  70. this.uk_btn.addEventListener(MouseEvent.ROLL_OUT,ukMouseOut);
  71. this.uk_btn.addEventListener(MouseEvent.CLICK,ukClick);
  72.  
  73. function aussieMouseOver(e:MouseEvent):void {
  74.     txt_Wheel.text = "Aussie Wheel";
  75. }//end aussieMouseOver
  76. function aussieMouseOut(e:MouseEvent):void {
  77.     txt_Wheel.text = "";
  78. }//endaussieMouseOut
  79. function aussieClick(e:MouseEvent):void {
  80.     soundChannel.stop();
  81.     gotoAndStop("mnu_Aussie");
  82. }//endAussieClick
  83.  
  84. function moneyMouseOver(e:MouseEvent):void {
  85.     txt_Wheel.text = "Big Money Wheel";
  86. }//end moneyMouseOver
  87. function moneyMouseOut(e:MouseEvent):void {
  88.     txt_Wheel.text = "";
  89. }//end moneyMouseOut
  90. function moneyClick(e:MouseEvent):void {
  91.     soundChannel.stop();
  92.     gotoAndStop("mnu_BigMoney");
  93. }//end moneyClick
  94.  
  95. function finlandMouseOver(e:MouseEvent):void {
  96.     txt_Wheel.text = "Finnish Wheel";
  97. }//endfinlandMouseOver
  98. function finlandMouseOut(e:MouseEvent):void {
  99.     txt_Wheel.text = "";
  100. }//end finlandMouseOut
  101. function finlandClick(e:MouseEvent):void {
  102.     soundChannel.stop();
  103.     gotoAndStop("mnu_Finnish");
  104. }
  105.  
  106. function gameboyMouseOver(e:MouseEvent):void {
  107.     txt_Wheel.text = "Gameboy Wheel";
  108. }
  109. function gameboyMouseOut(e:MouseEvent):void {
  110.     txt_Wheel.text = "";
  111. }
  112. function gameboyClick(e:MouseEvent):void {
  113.     soundChannel.stop();
  114.     gotoAndStop("mnu_Gameboy");
  115. }
  116.  
  117. function nesMouseOver(e:MouseEvent):void {
  118.     txt_Wheel.text = "NES Wheel";
  119. }
  120. function nesMouseOut(e:MouseEvent):void {
  121.     txt_Wheel.text = "";
  122. }
  123. function nesClick (e:MouseEvent):void {
  124.     soundChannel.stop();
  125.     gotoAndStop("mnu_NES");
  126. }
  127.  
  128. function phillipneMouseOver(e:MouseEvent):void {
  129.     txt_Wheel.text = "Phillipno Wheel";
  130. }
  131. function phillipneMouseOut(e:MouseEvent):void {
  132.     txt_Wheel.text = "";
  133. }
  134. function phillipneClick(e:MouseEvent):void {
  135.     soundChannel.stop();
  136.     gotoAndStop("mnu_Phillipno");
  137. }
  138.  
  139. function frenchMouseOver(e:MouseEvent):void {
  140.     txt_Wheel.text = "French Wheel";
  141. }
  142. function frenchMouseOut(e:MouseEvent):void {
  143.     txt_Wheel.text = "";
  144. }
  145. function frenchClick(e:MouseEvent):void {
  146.     soundChannel.stop();
  147.     gotoAndStop("mnu_French");
  148. }
  149.  
  150. function turntableMouseOver(e:MouseEvent):void {
  151.     txt_Wheel.text = "US Wheel";
  152. }
  153. function turntableMouseOut(e:MouseEvent):void {
  154.     txt_Wheel.text = "";
  155. }
  156. function turntableClick(e:MouseEvent):void {
  157.     soundChannel.stop();
  158.     gotoAndStop("mnu_US");
  159. }
  160.  
  161. function ukMouseOver(e:MouseEvent):void {
  162.     txt_Wheel.text = "UK Wheel";
  163. }
  164. function ukMouseOut(e:MouseEvent):void {
  165.     txt_Wheel.text = "";
  166. }
  167. function ukClick(e:MouseEvent):void {
  168.     soundChannel.stop();
  169.     gotoAndStop("mnu_UK");
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement