Sample: Audio.vbs - play mp3 sound in flash movie

Submitted by eLenka on 19 April, 2011 - 15:15

The sample shows using MP3 sound file as a background in flash SWF movie generated by the SWF Scout SDK.

See also: How to create flash movie with streaming mp3 audio

Generated Flash movie with mp3 music:

VB source code:

  W = 640
  H = 480
  Set Movie = CreateObject("SWFScout.FlashMovie")
  Movie.InitLibrary "demo","demo"
 
' Movie creating and setting parameters

  Movie.BeginMovie 0,0,W,H,1,12,6
  Movie.Compressed = true
  Movie.SetBackgroundColor 255,255,255
 
 Image = Movie.AddImageFromFilename("swfscout_logo.jpg")
  Movie.AddPreloader 0, 0,0,0,180, 0,255,0,30, "Loading (%d% completed)...", Image
 
 
 Font = Movie.AddFont( "Arial",12,true,false,false,false,0)
 FontBig = Movie.AddFont("Arial",40,true,false,false,false,DEFAULT_CHARSET)
 
'//////////////////////////
' MP3 AUDIO
'/////////////////////////

 Text = Movie.AddText2 ("MP3 Audio Demo:",0,0,0,255,FontBig, W / 2, 60,2)
 
  Sound = Movie.AddSoundFromFileName("bgmusic.mp3")
  Movie.StartSound (Sound)
  Movie.SOUND_AutoLoop = true
 
 Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text
 Movie.PLACE_FadeOut 2
 
 Movie.ShowFrame 5
 
 Text = Movie.AddText2 ("bgmusic.mp3",0,0,0,255,FontBig, W / 2, 120,2)
 
 Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text
 Movie.PLACE_FadeOut 2
 
 Movie.ShowFrame 80
 
 Movie.EndMovie
 
 Movie.SaveToFile "Audio.swf"

 

Download .zip with all required files and VB script: