Sample: FadeOutImages.vbs - create Flash slide show from JPEG images with Fade out effects

Submitted by eLenka on 29 April, 2011 - 15:35

This sample explains how to create flash slideshow with fading effects from JPEG images using SWF Scout SDK.

Generated Flash slideshow:

VB Source Code:

W = 640
 H = 480
 MaxDepth = 65000
 FadeOutTime = 1.5 ' seconds
 PauseTime = 2 ' seconds
 FPS = 12 ' frames per second
 ImagesCount = 3 ' number of images

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

Movie.BeginMovie 0,0,W,H,1,FPS,6
 Movie.Compressed = true
 Movie.SetBackgroundColor 255,255,255
 
Movie.AddPreloader 0, 0,0,0,180, 0,255,0,30, "Loading (%d% completed)...", -1
 
CurDepth = Movie.CurrentMaxDepth
 bUseFadeOut = true
 
for i=1 to ImagesCount
 
 img = Movie.AddImageFromFileName("NewImage" & CStr(i) & ".jpg")
 Movie.PlaceImage Img, CurDepth
 CurDepth = CurDepth +1
 Movie.PLACE_FadeOut FadeOutTime
 Movie.ShowFrame PauseTime * FPS
 Next
 
 Movie.EndMovie
 Movie.SaveToFile "SlideShowWithEffects_FadeOutImages.swf"

 

Also see the variation of example above modified to add support for starting slideshow on first mouse move:

VB Source Code:

W = 640
 H = 480
 MaxDepth = 65000
 FadeOutTime = 1.5 ' seconds
 PauseTime = 2 ' seconds
 FPS = 12 ' frames per second
 ImagesCount = 3 ' number of images

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

Movie.BeginMovie 0,0,W,H,1,FPS,6
 Movie.Compressed = true
 Movie.SetBackgroundColor 255,255,255
 
Movie.AddPreloader 0, 0,0,0,180, 0,255,0,30, "Loading (%d% completed)...", -1
 
Font = Movie.AddFont( "Arial",12,true,false,false,false,0)
 Text = Movie.AddText2 ("Move a mouse to start a slideshow",0,0,0,255,Font, W / 2, 60,2)
 Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text

' add sprite (movieclip) to listen to mouse events
 Sprite = Movie.AddSprite
 Movie.PlaceSprite Sprite, Movie.CurrentMaxDepth ' add sprite to the movie
 Action = Movie.AddScript ' add new script
 Movie.SCRIPT_AddCompiledBytecode "880D0002005F726F6F7400706C617900960700070000000008001C9602000801521700"
 Movie.PLACE_SetScriptForEvent Action, 4, 0 ' 4=mouseMove event

' // uncomment line with ".PLACE_CompileEvent" function below
 ' // if you have additional AS license so can compile source code
 ' // instead of using pre-compiled bytecode
 ' Movie.PLACE_CompileEvent "onClipEvent(mouseMove){_root.play();}"

CurDepth = Movie.CurrentMaxDepth
 bUseFadeOut = true
 
for i=1 to ImagesCount
 
 img = Movie.AddImageFromFileName("NewImage" & CStr(i) & ".jpg")
 Movie.PlaceImage Img, CurDepth
 
' stop movie after first image
 if i=1 Then
 ' set action for first frame to stop movie right after first frame is shown
 Action= Movie.AddScript
 Movie.SCRIPT_AddAction 62 ' sacttStop = 62
 Movie.SetFrameActions Action
 Movie.ShowFrame 1
 End If
 
 Movie.PLACE_FadeOut FadeOutTime
 Movie.ShowFrame PauseTime * FPS
 
CurDepth = CurDepth +1
 Next
 
 Movie.EndMovie
 Movie.SaveToFile "SlideShowWithEffects_FadeOutImages_StartOnMouseMove.swf"

 

Download ZIP archive with source code and all required files: