First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
Search tutorials
Author: Charles Jackson | Website: http://www.hedonismgames.com

This is actually a very simple tutorial, but it took me a while to figure out because I couldn't find anything about it anywhere!

First things first, create a text box and set it anywhere on the screen. This is the only asset, so you don't need seperate layers (unless you want to keep the good habit going! You do need to name it, however. If you want to copy mine, I used the name "text". Make sure that it's set to dynamic text and the render text as html is selected (it looks like the <%lt%><%gt%> symbol, to the right of the selectable button and two left from the var: box). Without this box, all HTML code would simply appear as normal letters!

Next, open up the actions screen. This program is only four lines long; it could be one, but it's always important to make your code as easy to edit as possible! Let me explain each line here:

  1. word = "red";
  2. color = "\"#FFFF00\"";
  3. text.htmlText = "This is <%lt%>FONT COLOR="+color+"<%gt%>" +word+"<%lt%>/FONT<%gt%>.";

Line One: I created a variable simply called "word" and set it to "red". Make sure the quotes are there, or it'll try to take from a variable instead of using the text.

Line Two: Another variable - color. To render HTML colors, you need it in hexadecimal format: "#RRGGBB", quotes included. To create the quotes, use the \". That's why that looks so funky :)

Line Four: This is the code that actually does the work. First, to make it format using the html, you need to use the .htmlText instead of .text. Then, we get to <%lt%>FONT COLOR="+color+"<%gt%>". To simplify, this translates to <%lt%>FONT COLOR="#FFFF00"<%gt%>. If you've ever used HTML, you'll realize the similarities. Second, following this is +word+. This simply adds the word variable in there. Then you close the font tag (<%lt%>/FONT<%gt%>), and presto!

Now here comes the fun part: Go ahead and switch those variables up! As long as you keep the color one the same, with 6 letters/numbers 0-F, it'll work. If you want a specific color, just look online for hexadecimal color codes.

And, finally - if you still have any questions, don't hesitate to let me know!

» Level Basic

Added: 2005-02-16
Rating: 4.64 Votes: 11
(10 being the highest)
» Author
Contract Game Developer, specialized in Flash. Still learning as I go (that's the fun!), and always glad to share what I learn.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.