SWF Scout |
Quick Guide:
How to create SWF flash animation movie from JavaScript
"Hello,
World!"example
You can download the source code of this example here: swfscout_javascript.zip SWF Scout library can be used in scripting languages that support ActiveX/COM objects: Javascript, VBScript, Visual Basic scripted language. This page will show how create SWF flash animation movie using Javascript and SWF Scout library. Windows 98/2000/ME/XP
have built-in JavaScript
support and all files with ".js"
are recognized as JavaScript
files and can be executed by system.
1)
Install SWF Scout
library on your computer
2)
Run Notepad
3)
To create SWF flash animation movie in JavaScript we have to write
a very simple script:
var
Movie = WScript.CreateObject('SWFScout.FlashMovie');
Movie.InitLibrary('demo', 'demo');
Movie.BeginMovie (0, 0, 640,
480, 1, 12, 6);
Movie.SetBackgroundColor(255,
255, 255); //
set background color to white
var
Font = Movie.AddFont('Arial', 18, true,
false,
false,
false,
0); // add font
//
create and place text
var
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
var
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('shapes.swf');
Feel free to copy the code
from this page, paste into the notepad and save as a "HelloWorld.js":
4)
Double-click "HelloWorld.js"
file from Explorer or from another file manager and the script
will be executed.
You can view the 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_javascript.zip
|
|
|
||