- Adding Sound to Animation

This section provides a tutorial example on create a simple Flash animation with sound using SWFC script with '.sound' and '.play' commands.

If you are interested to add sound to an animation, you can:

Here is my tutorial example,, which is based on with an MP3 music added in the animation:

#- Copyright (c) 2014,, All Rights Reserved.
.flash bbox=150x350 background=gray fps=12
.circle greenLight r=50 line=5 color=black fill=green
.circle yellowLight r=50 line=5 color=black fill=yellow
.circle redLight r=50 line=5 color=black fill=red
.sound mySound "Music_Sample.mp3"

#- Settig up the default frame which is frame 1
   .put greenLight x=25 y=225
   .play mySound loop=1

#- Making changes on frame 25
.frame 25
   .del greenLight
   .put yellowLight x=25 y=125

#- Making changes on frame 37
.frame 37
   .del yellowLight
   .put redLight x=25 y=25

#- Making changes on frame 61
.frame 61
   .del redLight
   .put greenLight x=25 y=225

Compile and generate the HTML code:

C:\herong>\local\SWFTools\swfc -o sound.swf
wav_read: not a WAV file
readMP3: skipping ID3 tag (10+4086 bytes)
readMP3: invalid header 54 41 47 43
"Music_Sample.mp3" seems to work as a MP3 file...

C:\herong>\local\SWFTools\swfdump -E sound.swf > sound.html

Remember to delete the extra "loop" parameter in sound.html and change the "loop" parameter value to "true". The you are ready to play sound.html.

I have included the HTML code here on this page. If you are reading the Web version of this book, you should be able to see the animation played. Otherwise, you will see a static image.

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

 Using "embed" Elements for Flash Files

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

SWFC Script to Generate Flash SWF Files

 What Is SWFC Script? - First SWFC Script Example - Managing Animation Frames - Adding Sound to Animation - Add Text to Animation

 ActionScript Embedded in SWFC Script

 AS3Compile - ActionScript 3 Compiler

 Adobe Flex SDK 4

 SWF File Structure and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials


 Full Version in PDF/EPUB