How to replace movieclips (sprites) in SWF flash movie template using SWF Scout library

Submitted by eLenka on 6 July, 2011 - 12:04

The sample below shows replacing
movieclips in the existing flash movie to movieclips loaded from external SWF file using SWF Scout SDK.

Input SWF template (MyTemplate.swf):

Red square is a movieclip with a name "image1". We will replace "image1" movieclip with SWF movieclip from shapes.swf file.
We'll also replace some text.

VB Source Code:

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","Shapes.swf", 4 ' 4 is a fit mode so movieclip will be fitted to rectangle of replaced image
 i = Movie.ProcessTemplateRules
 
Movie.EndMovie
 
Movie.SaveToFile "ProcessedTemplate_ReplaceSprites.swf"

Output SWF file (ProcessedTemplate_ReplaceSprites.swf):

Download source code and all related files (including FLA and SWFs):