How to create flash movie using SWF Scout SDK and Javascript

Submitted by eLenka on 7 July, 2011 - 15:42

Here you will find a quick guide on how to create SWF Flash animation movie in JavaScript using SWF Scout SDK: "Hello, World!"example.

SWF Scout SDK can be used in scripting languages that support ActiveX/COM objects: Javascript, VBScript, Visual Basic scripted language.

Windows has built-in JavaScript support and all .JS files 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.
 

Download source code: