Flash CS3 Tutorial, Sound
Links to some Great Flash CS3 Tutorials
FLash CS3 Tutorials using ActionScript 3.0
- F2- Flash CS3 Tutorials
- Gordon French is a Flash Developer and this is the home for His Free Flash CS3 Tutorials
- Flash CS3 Tutorials
- List of Flash CS3 Tutorials and ActionScript 3.0 Tutorials
- Flash CS3 Tutorial, Repeat Actions
- ActionScript 3.0 Tutorial on using Repeat Actions to Control Actions.
- Flash CS3 Tutorial, Preloader
- ActionScript 3.0 Tutorial on how to make preloader.
- F2-4Kids.com
- Educational Games, Kids online coloring book, This is a website dedicated to the education of Children. It started as a project to help my children develop there computer skill and has turned into F2-4Kids.com
- Flash CS3 Tutorial, Sound Basics
- F2- Flash CS3 Tutorials Gordon French is a Flash Developer. You have found His Free Flash CS3 TutorialsFlash CS3 Tutorial, Sound ActionScript 3.0 Tutorial on using sound.Flash CS3 Tutorial Hello fellow Flash...
Sound
Flash CS3 Tutorial over Sound
1. Import the sound into the library, then add the sound to a key frame in the time line.
2. Import the sound into the library and then use ActionScript to dynamically control the sound.
3. Use ActionScript to dynamically load and play the sound.
This Flash CS3 Tutorial is not really going to cover the first way to play a sound. You should know how to import an image into your library, you import a sound the same way. And just as you would drag an instance of an image onto the stage, you can also drag a sound onto the stage. The sound will simply play every time the key frame plays. Let work on the second way of playing a sound.
A sound file has already been imported into the library. However, if you wish to use your own audio file you can do so by going to File - Import - Import to Library, and select an audio file . Flash CS3 by default will allow you to import, AIF, WAV and MP3 files. There are additional plug ins that enable more files types. Right Click the audio file called Ring.wav. Select Linkage, Check export for ActionScript, leave the base class alone, but you may change the Class to any name you can remember. This CS3 Tutorial is simply going to delete the .wav from the Class name, thus calling the sound Ring.
CS3 Linkage Panel
Now, something needs to be done to call the sound. As normal select the first key frame on the actions layer and press F9 to open the actions panel. In Flash CS3 using ActionScript you need to create a new instance of just bout anything you want to work with. So, create a new instance of the sound by creating a new variable and setting it to the sound. In the example code the variable phoneRing was created, set as equal to a new instance of Ring. The next line of code actually tells flash to play the sound. After typing, or copying and pasting the code to your file, you may test it.
var phoneRing:Ring = new Ring()
phoneRing.play()
Press Control-Enter to hear your sound play once..
The last method of playing a sound is to load the sound dynamically. The advantage to dynamically load sounds is that the sounds will not increase the size of your .swf, thereby keeping the download times lower. Copy the code from the example and paste it in the actions panel below the code that makes the phone ring. URLRquest is a new method introduced in ActionScript 3.0. The getURL method no longer exists, therefore you may want to get familiar with URLRequest, but not in this CS3 Tutorial. In the example code you are simply telling Flash to go get the file listed in between the quotation marks. You can use http:// if the file is not located next to the .swf. Next in the example code, the variable Music is created and defined as a sound. Lastly, the variable music is loaded with the file from the URLRequest. At this point the sound is loaded but nothing is being done with it. Lets do something with it.
var yourRequest:URLRequest = new URLRequest ("SideOfABullet.mp3")
var Music:Sound = new Sound()
Music.load(yourRequest)
You should have noticed the stop and play button located in the start01.flv file. The final part of this Flash CS3 tutorial will be using those buttons. Before, ActionsScript can control the sound it needs to have a soundChannel defined. The example code creates a variable called controlMusic and data types it as a sound channel. You can then control the sound by simple calling on the variable controlMusic.
var controlMusic:SoundChannel
Add the final example code to the actions panel. You should be familiar with most of this code. You are simple adding event listeners to the stop and play buttons that were created for you. It is the code inside the events that should be new. First when the play button is clicked the sound channel you created earlier is set a Music.play(). remember you earlier defined Music as being equal to the audio file loaded when the .swf is called. So, the code associated with the play button is simple telling the music to play. It would stand to reason that the code associated with the stop button would then simply tell the music to stop. Just, remember that you have to control the sound channel, and not the sound directly.
play_btn.addEventListener(MouseEvent.CLICK, playMusic)
function playMusic(event:MouseEvent):void{
controlMusic= Music.play()
};
stop_btn.addEventListener(MouseEvent.CLICK, stopMusic)
function stopMusic(event:MouseEvent):void{
controlMusic.stop()
};
Press Control-Enter and test the file.
Congratulations, you should now be able to add sound to your website, note that you do not need to make the buttons play music, you have the basic code to make your navigation play a chime when clicked.
Download Flash CS3 Source Files
New RSS: Add Your Own Feed
Gordon's Picks
Here is a list of some of my favorite flash related web sites.
Fetching RSS feed... please stand byFlash CS3 stuff from Amazon
Flash CS3 Tutorial, sound
Flash CS3 Video Tutorials
Great Flash Tutorials from Utube
by FrenchSquared
Gordon French
Flash Tutorials
F2-4Kids.com.com
IT Admin
CSS How To (more)
















