Flash9:Toggling Sound On and Off

From virtualMV2015wiki
Revision as of 18:13, 14 January 2015 by Hesperides (Talk | contribs) (1 revision imported)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 Home  Flash9 (CS3), Flash10 (CS4), Flash11 (CS5) <


By the end of these exercises you should be able to:

  • Add sound to an invisible movieclip
  • Place an ON and an OFF button on the movie with code behind
  • Toggle the sound on or off when the buttons are pressed.

Open a new Flash file

1. Save as toggle.fla

Import your audio to the Flash Library

2. Locate media files, use WAV or MP3 format and drag into Flash Library.

Creating an invisible movie clip

3. Create a new Layer called invisibleMC

4. Draw a small circle on the stage & CONVERT TO SYMBOL

5. Rename as invisibleMC with an instance name mc

6. Click Movie Clip radio button & select OK

7. Hide movie clip on stage

Adding sound to the invisible movie clip

8a. Double click the invisible movie clip to open the clips editing panel 8b. Place a stop action in the first frame 8c. Place selected sound in the second frame 8d. Close the edit panel

Create an OFF button

9. Create any design on the scene

10. Add a label & name this OFF

11. Convert to a button

Add Action Script to OFF button

12. Put the following code on the button:

on (release) {
	with (mc) {
	  stopAllSounds ();

Create an ON button

13. Create any design on the scene

14. Add a label & name this ON

15. Convert to a button

Add Action Script to ON button

16. Put the following code on the button:

on (release) {
	with (mc) {
	  play ();

Ready to toggle

17. Export the movie to test

18. No background sound will play until the Play button is clicked on

19. Background sound will stop when the Stop button is clicked

Icon References.png References

Flash9:Toggling Sound On and Off. (2018). In virtualMV's ( Michael Verhaart ) wiki. Retrieved October 21, 2018, from http://www.virtualmv.com/wiki/index.php?title=Flash9%3AToggling_Sound_On_and_Off    (zotero)