OKIEWARDOYO

FLASH No.4 - 3

Apr 12th, 2012
6,127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.media.Sound;
  2. import flash.media.SoundChannel;
  3. import flash.events.MouseEvent;
  4.  
  5. var okie_sound:Sound = new Sound(new URLRequest(“TIPEX – SAAT SAAT MENYEBALKAN.mp3″));
  6. var okie_channel:SoundChannel;
  7. var sedangDimainkan:Boolean = false;
  8.  
  9. //button play kita
  10. okie_play.addEventListener(MouseEvent.CLICK, play_musik);
  11. okie_stop.addEventListener(MouseEvent.CLICK, stop_musik);
  12.  
  13. function play_musik(event:MouseEvent):void{
  14.     if(sedangDimainkan == true){
  15.         okie_channel.stop();
  16.     }
  17.     okie_channel = okie_sound.play();
  18.     sedangDimainkan = true;
  19. }
  20. function stop_musik(event:MouseEvent):void{
  21.     okie_channel.stop();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment