Embedding fonts inside your flash file helps to use a particular font even if its not present (installed) on the system.

Your just need to follow these steps to embed any font into your flash project:

Step 1. Select File -> New and create a new flash file.

Step 2. Make a dynamic text field on the stage and put any text on it. For example let the text be ” This is an example of embedded font “.

Step 3. Open Window -> Library , on the top right corner (just below x symbol) click the symbol and select “New Font”.

Step 4. Give the font any name (lets say myFont) and select the font you want to embed.

Step 5. Select the dynamic text field on the stage and open its properties window. Now select the font “myFont” from the fonts drop down list.

Step6. Click on the “Embed” button and and select all the symbols you want to embed (Note: Selecting more symbols with increase the size of your swf file)

Step 7. Compile and Run your file. Font has been embedded.

You can embed as many fonts as you may like to.

This post is for creating custom tooltips in flash using actionscript 3.

For Example if we want to show a tooltip over a movieclip (say box_mc) when we drag mouse over it and it should hide after the mouse leaves the movie clip.

Another important point is that the tooltip should change its x and y position as per the movement of the mouse when over the movieclip.

Lets begin.

Step 1. Create a box on the stage with the stage , select it and convert it to movieClip. Open its properties window and give it the instance name “box_mc”.

Step 2. Create a new layer and rename it “toolTip”. Create a new toolTip like movie clip as shown in the image and give it an instance name “tool”. Place a dynamic text box inside this “tool” movieclip so that we can show whatever toolTip we want to show at runtime.

Step 3. Create new layer and rename it as action. Put the following code on the first frame.

import flash.display.*;
import flash.events.MouseEvent;
import flash.ui.Mouse;

tool.tool_txt.text=”ToolTip is visible and its over the box!”;
stage.addEventListener(MouseEvent.MOUSE_MOVE,updateToolTipLocation);
box_mc.addEventListener(MouseEvent.MOUSE_OVER,showToolTip);
box_mc.addEventListener(MouseEvent.MOUSE_OUT,hideToolTip);
addChild(tool);
tool.visible=false;

function updateToolTipLocation(evt:MouseEvent):void {
tool.x=mouseX;
tool.y=mouseY;
}

function showToolTip(evt:MouseEvent):void {
tool.visible=true;
}

function hideToolTip(evt:MouseEvent):void {
tool.visible=false;
}

 

January 2012
M T W T F S S
« Jul    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

SocialVibe


Follow

Get every new post delivered to your Inbox.