Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

Playing streaming MP3 music in flash movie generated with SWF Scout library

Download ZIP with the source code (swfscout_streamSound.zip, 4 KB)

SWF Scout provides ability to use built-in ActionScript compiler (requires additional AS License)

To create a flash movie with streaming audio we will create a simple flash movie and will place an actionscript code that will initialize Sound object and will load and play flowers.mp3 file as streaming audio

ActionScript code is:

var mysound:Sound = new Sound();
mysound.loadSound('http://www.bytescout.com/demo/flowers.mp3', true);

the second parameter in loadSound() function is IsStreaming. We set it to TRUE to load flowers mp3 as streaming audio.

Important note: mp3 audio filename is case-sensitive!

To compile this code just pass it to SCRIPT_Compile function and SWF Scout will compile actionscript code using internal ActionScript compiler. Please note that to use ActionScript compiler in registered version of SWF Scout you have to have additional AS License

flowers.mp3 is 600KB in size but flash player will start to play it after few seconds after initial buffering and will download mp3 while playing.

Click here to open new window with flash movie that will stream flowers.mp3 from this server and will play this audio file on-the-fly

VBScript source code of StreamingSound.vbs example:

W = 640

H = 480

Se Movie = CreateObject("SWFScout.FlashMovie")

Movie.InitLibrary "demo","demo"

Movie.BeginMovie 0,0,W,H,1,12,6

Movie.Compressed = true

Movie.SetBackgroundColor 255,255,255

Font = Movie.AddFont( "Arial",12,true,false,false,false, 0)

FontBig = Movie.AddFont("Arial",40,true,false,false,false, 0)

Text = Movie.AddText("Playing streaming sound(using ActionScript) from:",0,0,0,255,Font, 0, 80, 170, 160)
Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text

Text = Movie.AddText("http://www.bytescout.com/demo/flowers.mp3",0,0,0,255,Font, 0, 110, 170, 320)
Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text

Script = Movie.AddScript

Movie.SCRIPT_Compile "var mysound:Sound = new Sound(); mysound.loadSound('http://www.bytescout.com/demo/flowers.mp3', true);"

' The Second parameter in mysound.LoadSound is IsStreaming. We set it to TRUE

Movie.ShowFrame 1

Movie.EndMovie

Movie.SaveToFile "swfscout_StreamingSound.swf"


Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement