Home
We need your feedback!

SWF Scout

SWF Scout screenshot (click to enlarge)


Subscribe to Our Bi-Monthly Newsletter (tips, new releases, specials):
 Subscribe in a reader
 PRODUCTS  |  DOWNLOAD  |  PURCHASE  |  SUPPORT  |  TESTIMONIALS   |  NEWS  | 

SWF Scout ActiveX/NET library

How to create SWF flash movie using SWF Scout library in ASP ( "Hello, World!" example)

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

This page provides a quick guide for generating of SWF flash animation movie using SWF Scout library in ASP

IMPORTANT NOTE: To use SWF Scout library on the web-server you have to have additional "Web License"
 
SWF Scout is capable of generating in-memory SWF files and so generated file needn't to be stored as a file on a hard drive and can be streamed right into the browser window. 
 
Library has the special "GenerateInMemoryFile" property for such purposes. You can set this flag to TRUE and the library will generate and keep SWF flash movie as in-memory stream. 
 
1) Install SWF Scout library on your computer and create an "CreateSimpleSWF.asp" file in the notepad.
CreateSimpleSWF.asp will generate SWF file and return it as a stream. 
Insert the following code into "CreateSimpleSWF.asp"
<%
 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.GenerateInMemoryFile = True
 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
 
 ' get generated SWF as binary image
 SWFfImage = Movie.BinaryImage
 ' clear the output stream
 response.Clear
 ' set the content type to SWF
 response.ContentType = "application/x-shockwave-flash"
 ' add content type header 
 response.AddHeader "Content-Type", "application/x-shockwave-flash"
 ' set the content disposition
 response.AddHeader "Content-Disposition", "inline;filename=shapes.swf"
 ' write the binary image to the Response output stream 
 response.BinaryWrite SWFImage
 response.End
 ' disconnect from library
 Set Movie = Nothing
%>
 
2) Now use Notepad to create HTML file that will display a flash movie animation, "HelloWorld.html". Insert the following HTML code into "HelloWorld.html":
 
<HTML>
<HEAD>
<TITLE>Hello, World!</TITLE>
</HEAD>
<BODY bgcolor="#ffffff">
<CENTER>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0"
ID="SWF" WIDTH="100%" HEIGHT="100%" VIEWASTEXT>
<PARAM NAME="movie" VALUE="CreateSimpleSWF.asp">
<PARAM NAME="quality" VALUE="best">
<PARAM NAME="bgcolor" VALUE="#ffffff">
</EMBED>
</OBJECT>
</CENTER>
</BODY>
</HTML>
 
Place both "CreateSimpleSWF.asp" and "HelloWorld.asp" files into the same folder on web-server. (This folder is C:\Inetpub\wwwroot\ by default in IIS on Windows 2000 and XP)
 
3) Now open "http://localhost/HelloWorld.asp" (or "http://<your_webserver_name>/HelloWorld.asp") in Internet Explorer browser. You will see the generated flash movie in a browser window:
 
Flash movie generated by ASP script
You can download the source code of this example here: swfscout_asp.zip



HOME  |  CONTACT US

Copyright © ByteScout, 2003-2010. Privacy Statement
Microsoft®, Windows®, Windows 2000®, Windows Server®, Windows Vista®, Internet Explorer®, .NET Framework®, ActiveX®, Visual Basic®, Visual C#®, ASP®, ASP.NET®, Excel®, PowerPoint®, are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Adobe®, Flash® and Acrobat® are registered trademarks of Adobe Systems, Incorporated. Mozilla®, Firefox® and the Mozilla and Firefox Logos are registered trademarks of the Mozilla Foundation. Other product names or brandnames used herein are for identification purposes only and might be trademarks or registered trademarks of their respective companies. We disclaim any and all rights to those marks.