Text.sc - Add Text to Animation

This section provides a tutorial example on create a simple Flash animation with text using SWFC script with '.font' and '.text' commands.

After adding sound to the Flash animation, let's see how to add text:

Here is my tutorial example, text.sc, which is based on sound.sc with text messages added in the animation:

#- text.sc
#- Copyright (c) 2014, HerongYang.com, All Rights Reserved.
.flash bbox=150x350 background=gray fps=12
.circle greenLight r=50 line=5 color=black fill=green
.circle yellowLight r=50 line=5 color=black fill=yellow
.circle redLight r=50 line=5 color=black fill=red
.sound mySound "Music_Sample.mp3"
.font arial "\Windows\Fonts\arial.ttf"
.text greenText font=arial text="Green" size=28pt color=black
.text yellowText font=arial text="Yellow" size=28pt color=black
.text redText font=arial text="Red" size=28pt color=black

#- Settig up the default frame which is frame 1
   .put greenLight x=25 y=225
   .put greenText x=35 y=275
   .play mySound loop=1

#- Making changes on frame 25
.frame 25
   .del greenLight
   .del greenText
   .put yellowLight x=25 y=125
   .put yellowText x=35 y=175

#- Making changes on frame 37
.frame 37
   .del yellowLight
   .del yellowText
   .put redLight x=25 y=25
   .put redText x=35 y=75

#- Making changes on frame 61
.frame 61
   .del redLight
   .del redText
   .put greenLight x=25 y=225
   .put greenText x=35 y=275

Compile and generate the HTML code:

C:\herong>\local\SWFTools\swfc text.sc -o text.swf

C:\herong>\local\SWFTools\swfdump -E text.swf > text.html

Remember to delete the extra "loop" parameter in text.html and change the "loop" parameter value to "true". The you are ready to play text.html.

I have included the HTML code here on this page. If you are reading the Web version of this book, you should be able to see the animation played. Otherwise, you will see a static image.

Last update: 2014.

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

 Using "embed" Elements for Flash Files

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

SWFC Script to Generate Flash SWF Files

 What Is SWFC Script?

 circle.sc - First SWFC Script Example

 Frame.sc - Managing Animation Frames

 Sound.sc - Adding Sound to Animation

Text.sc - Add Text to Animation

 ActionScript Embedded in SWFC Script

 AS3Compile - ActionScript 3 Compiler

 Adobe Flex SDK 4

 SWF File Structure and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials


 PDF Printing Version