How to create flash movie using SWF Scout SDK and VBScript (Visual Basic script)

Submitted by eLenka on 7 July, 2011 - 14:21

This tutorial will show you how to create SWF Flash animation in VBScript (Visual Basic script) using SWF Scout SDK on ASP.NET web-server.

SWF Scout SDK can be used in scripting languages that support ActiveX/COM objects: Javascript, VBScript, Visual Basic scripted language. 

Windows has built-in VBScript support and all .VBS files are recognized as VBScript files and can be executed by system.

1) Install SWF Scout SDK on your computer

2) Run Notepad.

3) To create SWF flash animation movie in VBScript, we have to write a very simple script:

 W = 640 ' width
 H = 480 ' height
 Set Movie = CreateObject("SWFScout.FlashMovie")
 Movie.InitLibrary "demo", "demo"
 Movie.BeginMovie 0, 0, W, H, 1, 12, 6
 Movie.SetBackgroundColor 255, 255, 255 ' set background color to white
 
 Font = Movie.AddFont("Arial", 18, True, False, False, False, 0) ' add font
 ' create and place text
 Text = Movie.AddText("Hello, World!", 0, 0, 0, 255, Font, 0, 100, 250, 160)
 Movie.PlaceText Text, Movie.CurrentMaxDepth ' place text into current depth
 Movie.PLACE_FadeOut 0.5 ' fade out text
 Shape = Movie.AddShape ' add new shape
 Movie.SHAPE_Rectangle 0, 140, 150, 285 ' draw rectangle
 Movie.SHAPE_SetSolidColor 50, 255, 50, True, 255 ' set solid fill for shape
 
 Movie.PlaceShape Shape, Movie.CurrentMaxDepth ' place shape into current depth
 Movie.ShowFrame 10 ' show 10 frames
 Movie.EndMovie ' end movie generation
 Movie.SaveToFile "shapes.swf" ' save file
 ' disconnect from library
 Set Movie = Nothing

Feel free to copy code from this page, paste into the notepad and save as a "HelloWorld.VBS":

4) Double-click "HelloWorld.VBS" file from Explorer or from another file manager and script will be executed.

You can view generated flash file (.SWF) using Internet Explorer or another application for playing flash animations.


 

Download source code: