Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

How to replace fonts in the existing flash movie using SWF Scout library and its SWF2XML/XML2SWF interfaces

Download source code of this example: swfscout_replace_fonts_in_swf_using_swf2xml.zip (100 KB)

IMPORTANT: use of XML2SWF and SWF2XML in registered version of SWF Scout requires additional "XML License"

Source flash movie with Arial font:

Produced flash movie (font has been replaced from Arial to Impact):

1. Source code (converting SWF with Arial to XML):

Set SWF2XML = CreateObject("SWFScout.SWF2XML")

SWF2XML.InitLibrary "demo", "demo"

SWF2XML.LoadSWFFromFile "TestWithArialFont.swf"
SWF2XML.FontsAsExternalFiles = true
SWF2XML.SaveToFile "TestWithArialFont.xml"

2. Source code (converting SWF with Impact to XML in order to extract font0.dat for Impact font):

Set SWF2XML = CreateObject("SWFScout.SWF2XML")

SWF2XML.InitLibrary "demo","demo"

SWF2XML.LoadSWFFromFile "TestWithImpactFont.swf"
' SWF2XML.FontsAsExternalFiles = true
SWF2XML.SaveToFile "TestWithImpactFont.xml"

Now we are replacing font0.dat from (1) with font0.dat from (2) so we replace Arial font data with Impact font data:

<?xml version="1.0" encoding="UTF-8"?>
<SWF XMax="12800" YMax="9600" FPS="12" Version="8" SystemCoord="Twips" Compressed="True">
<SetBackgroundColor Color="#FFFFFF"/>
<DefineFont2 File="Impact_font0.dat" FileType="bytecode" ID="1" Name="Arial" SmallText="True" ShiftJIS="False" ANSI="True" Italic="False" Bold="True" LanguageCode="0" Ascent="927" Descent="217" Leading="120"/>
<DefineEditText ID="2" XMin="200" YMin="3000" XMax="12800" YMax="8000" AutoSize="False" WordWrap="True" ReadOnly="True" NoSelect="True" UseOutlines="True" FontID="1" Height="640" Color="#FF787878" Variable="EditText">
<Value>
<![CDATA[This is a test text!]]>
</Value>
</DefineEditText>
<PlaceObject2 ID="2" Depth="2"/>
<ShowFrame/>
<End/>
</SWF>

3. Finally compile XML back to SWF to get SWF with Arial to Impact replaced:

Set XML2SWF = CreateObject("SWFScout.XML2SWF")

XML2SWF.InitLibrary "demo", "demo"

XML2SWF.LoadXMLFromFile "TestWithArialFontWithFontNameReplacedToImpact.xml", true
XML2SWF.Compile
XML2SWF.SaveToFile "TestWithArialFontWithFontNameReplacedToImpact.swf"

Download source code of this example: swfscout_replace_fonts_in_swf_using_swf2xml.zip (100 KB)


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