Sample: SlideShow.vbs - create flash slide show with navigation buttons using JPG images
Submitted by eLenka on 12 May, 2011 - 15:44
This sample shows how to create Flash slideshow with simple navigation buttons to navigate through slides.
Generated Flash slide show:
VB source code:
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,12,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 Text= Movie.AddTextEdit ("EditText","<b><i>Sample</I> TextEdit</b>: this <b>HTML text</b> is <b>editable</b>",0,255,100,255,Font,200, 200, 640, 400) Movie.TEXT_ReadOnly= false Movie.TEXT_NoSelect= false Movie.TEXT_IsHTML = true Movie.PlaceText Text, MaxDepth+1 ' 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 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 ' create a simple ActionScript that will back to prev frame Action= Movie.AddScript Movie.SCRIPT_AddAction 47 ' sacttNextFrame = 47 ' 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 ' 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 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 ' 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 ' create images For i = 1 to 3 ' change 3 to the number of images you have 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 Movie.SetFrameActions Action Movie.ShowFrame 1 NEXT Movie.EndMovie Movie.SaveToFile "SlideShow.swf"
Download source code: