Sound Effects in Flash
● Make a Sound when you Drop Items on a Target Location.
✓ Actionscript 3.0✓ Movie Clips ✓ Variables ✓ Sound
• This is the 6th tutorial in the Drag and Drop Project.
Other People's Work:
Here are example of work inspired by this tutorial …
Step #1: Download Sounds ~
✗ Download and Save the audio somewhere you can find it.
Step #2: Import into your Flash File ~
✗ Then open your project, go to: File > Import > Import to Library
✗ Then open the Library (if necessary) by hitting: Cmd (⌘) +L
✗ Look for the Sound you imported and Right-Click it.
✗ Click ActionScript
✗ Then click Export for Actionscript.
✗ Also give the sound a simple identifier like "boing" - keep it simple, no periods or spaces.
Step #3: Actionscript ~
✗ Click on your Actions and Labels keyframe:
✗ Then hit F9 and open the Actions panel and look for the var codes …
✗ Copy and paste this code below the other var codes:
var myBoing:boing = new boing ();
✗ The code looks like this:
Step #4: Create an Instance of the Sound ~
✗ Then scroll down a little further to find this code …
✗ This is the code that controls what happens when you Release the item …
✗ Copy the new code …
✗ The final code should look like this:
Step #9: Export your Work
✗ Go to: File > Export > Export Movie or hit Cmd (⌘) +Enter and see if it works!
✗ If you want more that one sound associated with different drag options the code would look like this:
var myBoing:boing = new boing(); var myBuzz:buzz = new buzz(); var myBell:bell = new bell(); // myBoing.play(); myBuzz.play(); myBell.play();
Last Step: Save and View your work ~
✗ View your work by hitting the keyboard shortcut: Cmd(⌘)+Enter
✗ Save your work as - FIRST_NAME_LAST_NAME_PROJECT_NAME.fla]
• ALWAYS save your projects using the following naming convention:
• DO NOT name your project any other way - Improperly named projects will not receive credit and you will be sad.
• NEVER leave your work on the desktop or depend on a flash drive - instead, save your work in a folder you can find later - preferably on a virtual drive where it can be backed up.
Other Resources: http://www.danfergusdesign.com/classfiles/oldClasses/VCB324-richMedia2/exercises/matchingGame.php