SWF Scout |
Quick Start Guide: How to create SWF file from Visual Basic: "Hello, World" example You can download the source code of this example here: swfscout_vb.zip This guide will teach you how to create simple SWF flash animation using SWF Scout library and Visual Basic 1)
Install SWF Scout library on your computer and run Visual
Basic. Go to File and click New
![]() The
Project Wizard will appear:
![]() 2)
Select Standard EXE project type and click Open to
create a new project.
Visual Basic will generate new project called Project1 and will automatically open the main form of the generated project: ![]() 3)
Click on Form1 surface and Visual Basic will show
the code window for Form_Load event:
![]() 4)
Now you have to add the code that will create SWF flash movie file
using SWF Scout library.
Here is
the source code that you can simply copy and paste into Visual
Basic:
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.Compressed = True
Movie.SetBackgroundColor 255, 255, 255
' set background color to white
Dim Font
As Integer
Font = Movie.AddFont("Arial", 18, True,
False, False, False, 0) ' add font
' create and place
text
Dim Text
As Integer
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
Dim Shape
As Integer
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 "c:\Shapes.swf" '
save generated SWF into file
This function
will create SWF file "Shapes.swf" on drive C:\
Hint:
You can
simply copy the source code from the snippet above and then paste
it in the Visual Basic code editor as it's shown on the screenshot
below:
![]() 5)
Press F5 to run the application (you can also use "Run"
| "Start" menu command).
![]() 6)
Visual Basic will run the application and application will generate
SWF file "c:\Shapes.swf".
You can
view generated flash file (.SWF) using Internet Explorer
or another application that is capable of viewing and playing of
flash animations.
![]() You can
download the source code of this example here: swfscout_vb.zip
|
|
|
||