W = 640
H = 480
MaxDepth = 65000
FramesPerImage = 18 ' number of frames for every image in slide show
Set Movie = CreateObject("SWFScout.FlashMovie")
Movie.InitLibrary "demo","demo"
' Movie creating and setting parameters
Movie.BeginMovie 0,0,W,H,1,15,6
Movie.Compressed = true
Movie.SetBackgroundColor 255,255,255
Font = Movie.AddFont( "Arial",12,true,false,false,false,0) ' font used for text
Text = Movie.AddText ("Sample Slide Show",0,0,0,255,Font, 200, 20, 600, 160)
Movie.PlaceText Text, MaxDepth ' place text on maximum depth
' create and place Next and Prev buttons
' NEXT button
Img = Movie.AddImageFromFileName ("NextButton.jpg")
Shape = Movie.AddShape
Movie.SHAPE_RoundRect 0,0,166,48,10
Movie.SHAPE_SetImageFill img, 1 ' sfimFit fill image mode = 1
Img_Grayed = Movie.AddImageFromFileName ("NextButton_Grayed.jpg")
Shape_Grayed = Movie.AddShape
Movie.SHAPE_RoundRect 0,0,166,48,10
Movie.SHAPE_SetImageFill Img_Grayed, 1 ' sfimFit fill image mode = 1
Button = Movie.AddButton (false, true) ' add button
' set shape with image fill as shapes used for different button states
Movie.BUTTON_AddShape Shape_Grayed, 0 ' sbstUp = 0
Movie.BUTTON_AddShape Shape_Grayed, 1 ' sbstDown = 1
Movie.BUTTON_AddShape Shape, 2 ' sbstOver = 2
Movie.BUTTON_AddShape Shape, 3 ' sbstHitTest = 3
' create a simple ActionScript that will set to next frame
Action= Movie.AddScript
' Movie.SCRIPT_AddAction 47 ' sacttNextFrame = 47
Movie.SCRIPT_AddAction 62
Movie.SCRIPT_SetTarget "_root"
Movie.SCRIPT_AddAction 48
Movie.SCRIPT_SetTarget ""
' set script on button click
Movie.BUTTON_SetScriptOnEvent 2, Action ' sbePress = 2
' place button to movie
Movie.PlaceButton Button, MaxDepth+2 ' we use max depth for buttons
Movie.PLACE_SetTranslate 20,10
Movie.PLACE_Name = "nextbtn"
' PREVIOUS button
Img = Movie.AddImageFromFileName ("PrevButton.jpg")
Shape = Movie.AddShape
Movie.SHAPE_RoundRect 0,0,166,48,10
Movie.SHAPE_SetImageFill img, 1 ' sfimFit fill image mode = 1
Img_Grayed = Movie.AddImageFromFileName ("PrevButton_Grayed.jpg")
Shape_Grayed = Movie.AddShape
Movie.SHAPE_RoundRect 0,0,166,48,10
Movie.SHAPE_SetImageFill img_Grayed, 1 ' sfimFit fill image mode = 1
Button = Movie.AddButton (false, true) ' add button
' set shape with image fill as shapes used for different button states
Movie.BUTTON_AddShape Shape_Grayed, 0 ' sbstUp = 0
Movie.BUTTON_AddShape Shape_Grayed, 1 ' sbstDown = 1
Movie.BUTTON_AddShape Shape, 2 ' sbstOver = 2
Movie.BUTTON_AddShape Shape, 3 ' sbstHitTest = 3
' create a simple ActionScript that will back to prev frame
Action= Movie.AddScript
Movie.SCRIPT_AddAction 50 ' sacttPreviousFrame = 50
' set script on button click
Movie.BUTTON_SetScriptOnEvent 2, Action ' sbePress = 2
' place button to movie
Movie.PlaceButton Button, MaxDepth+3 ' we use max depth for buttons
Movie.PLACE_SetTranslate 20,70
Movie.PLACE_Name = "prevbtn"
' add background sound
Movie.AddSoundFromFileName "bgmusic.mp3"
Movie.SOUND_AutoLoop = true
Movie.StartSound(Sound)
Movie.ShowFrame 1
Img = Movie.AddImageFromFileName ("MuteBtn.jpg")
Shape = Movie.AddShape
Movie.SHAPE_RoundRect 0,0,166,48,10
Movie.SHAPE_SetImageFill Img, 1 ' sfimFit fill image mode = 1
Button = Movie.AddButton (false, true) ' add button
' set shape with image fill as shapes used for different button states
Movie.BUTTON_AddShape Shape, 0 ' sbstUp = 0
Movie.BUTTON_AddShape Shape, 1 ' sbstDown = 1
Movie.BUTTON_AddShape Shape, 2 ' sbstOver = 2
Movie.BUTTON_AddShape Shape, 3 ' sbstHitTest = 3
Action= Movie.AddScript
Movie.SCRIPT_AddAction 63 ' sacttStopSounds = 63
' set script on button click
Movie.BUTTON_SetScriptOnEvent 2, Action ' sbePress = 2
' place button to movie
Movie.PlaceButton Button, MaxDepth+4 ' we use max depth for buttons
Movie.PLACE_SetTranslate 20,120
Movie.PLACE_Name = "mutebtn"
' create images
' ImageCount is total count of images
ImageCount = 3
For i = 1 to ImageCount
img = Movie.AddImageFromFileName("NewImage" + FormatNumber(I,0) + ".jpg")
Shape = Movie.AddShape
Movie.SHAPE_RoundRect 0, 0, W, H, 10
Movie.SHAPE_SetImageFill img, 1 ' sfimFit fill image mode = 1
UsedDepth = Movie.CurrentMaxDepth
Movie.PlaceShape Shape, UsedDepth
Action= Movie.AddScript
Movie.SCRIPT_AddAction 62 ' sacttStop = 62
' add commands to automatically enable or disable Prev and Next buttons
Movie.SCRIPT_Push "prevbtn"
Movie.SCRIPT_AddAction 30 'sacttGetVariable action ID is 30
Movie.SCRIPT_Push "enabled"
if i = 1 then ' this is the first frame so we will disable prev button
Movie.SCRIPT_Push false
Else ' else we should enable this button
Movie.SCRIPT_Push true
End If
Movie.SCRIPT_AddAction 56 'sacttSetMember action ID is 56
' Next button
Movie.SCRIPT_Push "nextbtn"
Movie.SCRIPT_AddAction 30 'sacttGetVariable action ID is 30
Movie.SCRIPT_Push "enabled"
if i = ImageCount then ' this is the last frame so we will disable next button
Movie.SCRIPT_Push false
Else ' else we should enable this button
Movie.SCRIPT_Push true
End If
Movie.SCRIPT_AddAction 56 'sacttSetMember action ID is 56
Movie.SetFrameActions Action
Movie.ShowFrame 1
NEXT
Movie.EndMovie
Movie.SaveToFile "SlideShowWithSound.swf"
download ZIP with all required files and VB script