Your Account | View Cart | Checkout | Products
Partners In Rhyme
Royalty free music, Sound effects, Midi files, Audio software and Sound advice
Royalty Free Music & SFX
Royalty Free Music Libraries
Royalty Free Music Tracks
Dramatic Music
Royalty Free Classical Music
Rock and Blues Music
Ambient Chill Music
Romantic Music
Techno & Dance Music
World Music
Jazz & Lounge Music
Ambient Music
Royalty Free Sound Effects
Relaxation CDs
Cool iPhone Apps
Free Sounds & Video
Free Music Loops
Free Sound Effects
Free Midi Files
Free Video Loops
Audio Software
Audio Software for PC
Audio Software for Mac
Sound Advice
Audio Tutorials
F A Q
About Us




  Tutorials
 
Browse by Category:       Tutorials Home
 
View Categories in "Adding Audio to Projects"
Final Cut Pro (2)Pro Tools (2)PowerPoint (1)
Audacity (1)Avid Xpress (2)Flash (7)
Adobe Premiere (3)iMovie (3)iTunes (3)
Band in a Box (1)
 
Adding Audio to Projects >> Flash >> Flash Audio: Streaming MP3's in Flash
Next


Flash Audio: Streaming MP3's in Flash

This tutorial will shortly explain the importance of the loadSound method. This method is used when you want to load external MP3 files. Here is the syntax:
public loadSound(url:String, isStreaming:Boolean) : Void
Let's see how it works!
As I already said, this loads an MP3 file into the Sound object you created. The parametar isStreaming is interesting. You can use it to indicate whether the sound is an event or a streaming sound.
Just like it is the case with every sound, event sounds must be completely loaded before they play. They are managed by the ActionScript Sound class and respond to all methods and properties of this class.
Streaming sounds play while they are downloading. Playback begins when sufficient data has been received to start the decompressor.
All MP3s (event or streaming) loaded with this method are saved in the browser's file cache on the user's system. Here is the overview of the two parameteres:
url:String - The location on a server of an MP3 sound file.
isStreaming:Boolean - A Boolean value that indicates whether the sound is a streaming sound (true) or an event sound (false).
Let's create an example!
Open up a new Flash document. Place an input text field onto the stage (Image 1).
Streamign Audio on Flash

Give it an instance name songName_txt (Image 2).

Streaming MP3 audio in Flash

Add a simple button besides the text field and give it the instance name startSound_btn.(Image 3)

Load sound flash tutorial

Ok, now add an additional layer and name it „Actions“. Rename the layer with the text field at the botton to „Text Field“ (Image 4).



Make sure you have MP3 tracks in the same folder where the Flash movie resides.
Select the first frame of the layer Actions and add the following ActionScript:
var soundToLoad:Sound = new Sound();
startSound_btn.onRelease = function () {
    var song = songName_txt.text;
    soundToLoad.loadSound(song, true);
}
soundToLoad.onLoad = function () {
    this.start(0, 1);
}
Test the movie. Type in the name of one of your tracks and press the start button. The mp3 file should load and play!