Follow Me On

 

https://www.youtube.com/user/mrsumitranaware

https://www.instagram.com/sumit.ranaware/

https://sumalno.wordpress.com/

https://www.facebook.com/suma.lno/

Advertisements

How to Create a Music Player – Basic

 

  1. Your need at least one .wav file. If you dont have it. Select any mp3 file and then convert it to .wav. Once you have a .wav file , import that file in your new flash library .
  2. Now create two buttons as “Play” & “Stop”. Instance name as “play_” & “stop_” respectively.
  3. Open the library and right click on the wav file. Select Linkage. Set class as “my_sound_file”.
  1. Goto frame 1 and copy the code:
     

    // set my_sound_file as : sound.

    var sound:Sound=new my_sound_file();

    var my_channel:SoundChannel;

     

     

    play_.addEventListener(MouseEvent.CLICK, Play_it)

    function Play_it (e:Event){

    // play the sound.

    my_channel = sound.play();

    }

     

    stop_.addEventListener(MouseEvent.CLICK, stop_it)

    function stop_it (e:Event){

    // stop the sound.

    my_channel.stop();

    }

     

    5. Test Movie . If every thing works fine , you shall enjoy further advance tutorial.