Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

How to create and use FLA-based SWF template for use in SWF Scout programming library for the new flash movie generation

This tutorial will teach you how to create and prepare FLA flash templates in Macromedia Flash MX for further use with SWF Scout library.

So you can draw template with complex graphics in Flash MX and then use

SWF version of template with SWF Scout and replace shape objects with external images, replace text in text objects.

The procedure is the following:
  1. Create flash document in Macromedia Flash MX
  2. Add shapes and text objects
  3. Export flash document as SWF file
  4. Use this SWF file with SWF Scout library
Start Flash MX, go to File menu and click New... to create new flash document:

Flash MX file menu

Default type is Flash Document. Click OK to create an empty flash document:

New flash document type

Flash MX will create new empty flash document project:

Flash MX main screen

Now select Rectangle Tool on "Tools" toolbar by click on its icon or pressing R

Select shape tool on toolbar


Then draw rectangle using a mouse: click on the blank area, hold left mouse button and draw rectangle:

Draw rectangle on stage

Now we have to convert this rectangle to the symbol.

To convert a shape to a symbol switch to Selection Tool by click on the appropriate icon on Tools toolbar in Flash MX:

Selection tool

Now click on the rectangle shape and right-click on it to show context menu and select Convert to Symbol command:

Context menu and Convert to Symbol command

Flash MX will show Convert To Symbol dialog.

Enter Image1 as name. Check Export for ActionScript and enter identifier: Image1 as shown on the screenshot below:

New symbol name

Click OK to close the dialog.

Now we will add the text box. Select Text Tool on "Tools" toolbar in Flash MX

Text tool

Then draw the text box using a mouse:

Draw text on flash surface

Click inside the text box and type the new text: REPLACEME1 REPLACEME2

Later we will replace REPLACEME1 and REPLACEME2 keywords with another text using SWF Scout

Now save FLA project so you will be able to modify it if needed:

Save MyTemplate.fla

SWF Scout is capable of loading SWF templates so we should export our flash document template into SWF file.

To export SWF flash movie open File menu in Flash MX and click Export Movie command in Export sub-menu as shown below:

Export SWF file menu


Export flash movie as MyTemplate.SWF file:

Export flash movie as SWF file

SWF export settings dialog will appear. Click OK to export to SWF:
SWF file settings

Now we have MyTemplates.SWF file that we will use as template with SWF Scout library

Here is a screenshot of MyTemplates.SWF flash movie:

MyTemplate.SWF screenshot

Now we will implement the code for use with SWF Scout library that will do the following replacements in the template:
    1. Replace image1 shape with image from NewImage1.jpg file
    2. Replace REPLACEME1 keyword with "SUCCESSFULLY REPLACE" text
    3. Replace REPLACEME2 keyword with "SUCCESSFULLY REPLACED TOO" text
Content of ProcessSWFTemplate.vbs:

  Set Movie = CreateObject("SWFScout.FlashMovie")

  Movie.InitLibrary "demo","demo"

  Movie.BeginMovieFromTemplate "MyTemplate.swf",true

  Movie.AddTemplateRule_Text "REPLACEME1","SUCCESSFULLY REPLACED",true
  Movie.AddTemplateRule_Text "REPLACEME2","SUCCESSFULLY REPLACED TOO",true
  Movie.AddTemplateRule_Image "image1","NewImage1.jpg", 0
  i = Movie.ProcessTemplateRules

  Movie.EndMovie

  Movie.SaveToFile "ProcessedTemplate.swf"

This script will process template file and will save result into ProcessedTemplate.swf file.

Screenshot of ProcessedTemplate.swf :

ProcessedTemplate.swf screenshot

As you can see rectangle shape was replaced with image from NewImage1.jpg file and keywords REPLACEME1 and REPLACEME2 were replaced with "SUCCESSFULLY REPLACED" and "SUCCESSFULLY REPLACED TOO" accordingly.

That's all!

Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement