Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

Quick Start Guide with SWF Scout library and Visual Basic.NET:  "Hello, World!" example

You can download the source code of this example here: swfscout_vb_net.zip

This page contains step-by-step tutorial that will teach you how to create SWF animation file in Visual Basic.NET application using SWF Scout library.

 
1) Install SWF Scout library on your computer and run Microsoft Visual Studio 2003.NET
 
Go to New menu and click Project... to create new project as shown on screenshot below:
 
File menu in VB net IDE
 
You will see New Project Wizard. Select Windows Application in Visual Basic Projects group:
 
New project wizard
 
2) VB.NET will create a new project:
 
New project generated by wizard
 
3) To use SWF Scout in Visual Basic.NET we have to add reference to SWF Scout library for current VB.NET project. Select Project in the main menu and click Add Reference command:
 
Add reference menu command
 
Switch to COM tab and find SWF Scout library in the list of available COM objects:
 
Add reference dialog
 
Now click on Select button to add reference to SWF Scout and click OK
 
Click OK button
 
4) Now add the code that will create "Hello, World!" SWF flash movie. Double-click Form1 to create Form1_Load event procedure:
 
VB.NET project form
 
The source code editor window will be appear:
 
Source code editor window
 
5) The code that generate "Hello, World!" SWF flash movie is below. Created flash animation file will be saved into "c:]Shapes.swf" file. You can simply copy-and-paste this code into your project.
          
          Dim Movie As SWFScout.FlashMovie
        Movie = New SWFScout.FlashMovie
        Movie.InitLibrary("demo", "demo")
        Movie.BeginMovie(0, 0, 640, 480, 1, 12, 6)
        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
 
Hint:
You can simply copy the source code from the snippet above and paste into Visual Basic.NET code editor window:
Code editor window
 
6) Press F5 to run the application (you can also use "Debug" | "Start" menu command) and Visual Basic.NET will run the application:
 
Run project menu command
 
The application will generate flash animation file and will save it as "Shapes.swf" file in root folder of C:\ drive. 
 
You can view generated SWF movie using Internet Explorer, Mozilla Firefox or another application that is able to open and play flash movies.
 

Flash movie generated by VB.NET project

You can download the source code of this example here: swfscout_vb_net.zip


Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement