SWF Scout |
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:
Start Flash MX, go to File menu and click New...
to create new flash document:
![]() Default type is Flash Document. Click OK to create
an empty flash document:
![]() Flash MX will create new empty flash document project:
![]() Now select Rectangle Tool on "Tools" toolbar by
click on its icon or pressing R
![]() Then draw rectangle using a mouse: click on the blank area, hold
left mouse button and draw rectangle:
![]() 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:
![]() Now click on the rectangle shape and right-click on it to show context
menu and select 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: ![]() Click OK to close the dialog. Now we will add the text box. Select Text Tool on "Tools"
toolbar in Flash MX ![]() Then draw the text box using a mouse:
![]() 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:
![]() 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 flash movie as MyTemplate.SWF file:
![]() SWF export settings dialog will appear. Click OK to export
to SWF:
![]() 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:
![]() Now we will implement the code for use with SWF Scout library
that will do the following replacements in the template:
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 :
![]() 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! |
|
|
||