How to create flash movie using SWF Scout SDK and Visual Basic
Check out this quick start guide on how to create SWF file in Visual Basic: "Hello, World" example. This tutorial will teach you how to create simple SWF flash animation using SWF Scout SDK and Visual Basic
1) Install SWF Scout SDK 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 a new project called Project1 and will automatically open the main form of the generated project:
3) Click the Form1 window and Visual Basic will show 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 Flash file Shapes.swf on C:\ drive.
Hint: you can simply copy the source code from the snippet above and then paste it to the Visual Basic code editor:
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 flash file c:\Shapes.swf.
You can view generated flash file (.SWF) using Internet Explorer or another application that for playing flash animations.
Download source code: