Wednesday, January 6, 2010

Creating Flash Projects

Flash makes it easy for you to create a project. When you open Flash, one of your first options is to create a Flash project. Under the central Create New selection, you’ll want to choose the final option, Flash Project.

Select Flash Project to create a new project. The New Project window opens and asks you for a name and location for you new project file (the extension to all Flash projects is FLP).

After you’ve created your project file, a new window—called the Project window—opens to list all of the files in your project.

What you now have is an empty project folder. At this point, all you have to do is add your folders and files.

Working With Text: Embedding Fonts

By default, Static text embeds the font outlines of this text so that it looks the same in your Web browser. Dynamic and Input text do not. If the user does not have the font on his computer, the text will look like error.

Font embedding is managed in the Properties Inspector for any Dynamic or Input text. In the following image, I’ve selected a Dynamic text block from the Stage and highlighted the Properties for it. You’ll see a button on the right side labeled "Embed..."

Selecting the Embed... button opens the Character Embedding window:

Embedding fonts in AS3

I love this! ... library, be-gone!

package {

import flash.util.describeType;
import flash.display.MovieClip;
import flash.display.TextField;
import flash.text.TextFormat;
import flash.text.AntiAliasType;

public class Test extends MovieClip {

// be sure this is pointing to a ttf font in your hardrive
[Embed(source="C:\WINDOWS\Fonts\somefont.ttf", fontFamily="foo")]
public var bar:String;

public function Test() {

var format:TextFormat = new TextFormat();
format.font = "foo";
format.color = 0xFFFFFF;
format.size = 130;

var label:TextField = new TextField();
label.embedFonts = true;
label.autoSize = TextFieldAutoSize.LEFT;
label.antiAliasType = AntiAliasType.ADVANCED;
label.defaultTextFormat = format;
label.text = "Hello World!";