SWF Scout |
Quick Guide
on how to create "Hello, World!" flash movie using C# and SWF
Scout library
You can download the source code of this example here: swfscout_csharp.zip This page will show how to use Visual C# and SWF Scout library to create "Hello, World!" flash movie (.SWF) 1)
Install SWF Scout
library on your computer
and run Microsoft
Visual Studio.NET
Go to New
menu and click Project...
to create new Visual
C# project
![]() The New Project Wizard
will appear. Select
Windows Application
in Visual C# Projects
group:
![]() 2) Visual
C# will create
a new empty project:
![]() 3) To
use SWF Scout library
in Visual C# application
we should add the reference to SWF
Scout. Select Project
in the main menu and then select Add
Reference command:
![]() Switch to COM
tab and find SWF
Scout library in
the list of available ActiveX/COM objects:
![]() Click Select
button to add the
reference to SWF
Scout library and
click OK:
![]() 4) Double-click
on form Form1 to create the Form1_Load procedure
(this procedure will be execute on Form1.OnLoad event):
![]() The source code editor
window will appear:
![]() 5)
The following code snippet generates simple "Hello, World!" SWF
flash movie and saves it into "c:\shapes.swf" file:
SWFScout.FlashMovie
Movie = new SWFScout.FlashMovie();
Movie.InitLibrary("demo",
"demo");
Movie.BeginMovie(0,
0, 640, 480, 1, 12, 6);
int
Font = Movie.AddFont("Arial", 18, true,
false,
false,
false,
0); // add font
//
create and place text
int
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.5F);
// fade out text
int
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
C# source code
editor:
![]() 6)
Press F5 to
run the application (you can also use "Debug"
| "Start"
menu command) and Visual
C#.NET will run
the application:
![]() The application will create
"Hello, World!" flash animation movie and save it into "c:\shapes.swf"
file.
You can view generated
flash animation using any application that can play flash movies:
Internet Explorer,
Mozilla Firefox
and etc.
![]() |
|
|
||