Monday, July 25, 2011

How to play a internal sound file in action script 3.0

1. First create a flash file named Mysound.fla
2. Impor sound into library. File -Import-Import to Library

4. Select the file you want to play. the selected file go to the Library window.
5.Then right click the sound file you want to play you can see the "Linkage ". Select the Linkage a window will open.

6.Give the class name to "mysound".
7. Tick  the Export  for Action Script then Click Ok button.

7.The flash give a warning window. It will create a class for sound file. Then clik ok.

8.Click the top frame. and Press F9 for the action script window.

9. Then type the following code.
var _mysound:mysound=new mysound();
var _channel:SoundChannel=new SoundChannel();;

10.Then press the " Ctrl+Enter".The sound file will play.