Flash Basics Tutorial #3: Creating 3d Text

How to create 3d looking text.


http://www.youtube.com/watch?v=gsIwH3LZiq4

In this tutorial, I demonstrate how to create text and make it look 3d.

Concepts learned:

  • Breaking Apart Objects
  • Changing Fill Colors
  • Copying and Pasting
  • Snapping
  • Using the Gradient Transform Tool
  • Using the Line Tool
  • Using the Text Tool
  • Using the Zoom Tool
  • Using Undo
  • Working with Text
  • Working with Gradients

Flash Basics Tutorial #2: Making the Ball Bounce Look Real

Part II of Creating a Bouncing Ball.


http://www.youtube.com/watch?v=rmHNh8hVMyU

In this tutorial, I demonstrate how to make the bouncing ball more realistic looking.

Concepts learned:

  • Moving Through the Timeline
  • Entering Keyframes
  • Easing In/Out
  • Demonstrating Object Materials
  • Using the Free Transform Tool

To create the bouncing ball, please watch Part I of this tutorial: Flash Basics Tutorial #1: Creating a Bouncing Ball
Or download the finished Part I file here.


Flash Basics Tutorial #1: Creating a Bouncing Ball

The first in my new series of Flash tutorials is now live on YouTube. Just click the video or the link below the video to watch it.

http://www.youtube.com/watch?v=2S9BXYiP9Tc

In this tutorial, I demonstrate how to create a bouncing ball.

Concepts learned:

  • Using the Oval Tool and Line Tool
  • Using the Color Palette
  • Creating Symbols
  • Inserting Frames and Keyframes
  • Using Guide Layers
  • Creating Classic Tweens

Adding ActionScript to Multiple Instances

I wrote a small snippet of ActionScript 2.0 the other day that I was quite proud of. It actually isn’t a very complicated block of code, but I was having trouble making a movieclip do what I wanted so I was quite pleased when I finally got it to work.

Here was my problem:

I had a movieclip, twenty-four frames long, with twenty-three buttons inside. When the mouse moved over each button, the movieclip was supposed to go to a different frame. I didn’t want to code each button individually because that can be tedious, so I employed a method I have often used to add the same code to multiple buttons. First I gave the timeline a name by assigning it to a variable:


var menus:MovieClip = this;
 

My buttons inside the movieclip were named btn1 through btn23, so I then created a for statement like so:


for (var i=1; i< =23; i++) {
    t = menus[“btn”+i];
    t.onRollOver = function() {
        gotoAndStop(i+1);
    }
    t.onRollOut = function() {
        gotoAndStop(1);
    }
}
 

Using the temporary variables t and i, I was able to assign onRollOver and onRollOut functions to each button. The code actually worked really well when the mouse rolled off the buttons, but when the mouse rolled over the buttons, the movieclip always went to Frame 24 (23 + 1), no matter which button it was over. Obviously, this wasn’t going to work.

I tried several things to make the code work, and had no luck. For some reason, whenever I used the i variable in referencing the frame to go to, it only registered as being equal to 23. I had to figure out a way to capture the value of i at each iteration. Then it occured to me. Since i wasn’t working, maybe I could reference the object directly, using the instance name to tell the movieclip which frame to go to. That was easy enough to do using this._name, but I still had the problem of getting rid of the btn part of the instance names. That was when I remembered substring. I rewrote my code to convert the substring of each instance name to an integer, added 1, and it worked perfectly. My code now looked like this:


var menus:MovieClip = this;

for (var i=1; i < =23; i++) {
    t = menus[“btn”+i];
    t.onRollOver = function() {
        gotoAndStop(int(substring(this._name, 4, this._name.length)) + 1);
    }
    t.onRollOut = function() {
        gotoAndStop(1);
    }
}
 


Variables and Data Types in ActionScript

Continued from Understanding Variables:

Like most programming languages, ActionScript variables follow a set of rules when it comes to naming. ActionScript variable names can have letters, numbers, dollar signs, and underscores, but they cannot start with a number. ActionScript variables are also case-sensitive.

ActionScript variables are a little unusual in that any variable can store any type of data. When a piece of data is assigned to a variable, the interpreter automatically changes the variable type to whatever type the data is. In programming languages like Java and C++, data of the wrong type is converted to the variable’s data type instead of the other way around, or an error is caused in the program.

Alternatively, ActionScript variable types can be set when the variable is declared.

ActionScript 2.0 has several built-in data types:

  • Boolean – a data type with only two possible values: true or false
  • MovieClip – a special data type used for controlling movie clip instances
  • null – a special data value representing an absence of data; default value for variables declared without a value
  • Number – any series of numeric values, including integers, unsigned integers, and floating point numbers; mainly used for counting and mathematical equations
  • Object – built-in or user-defined classes of data; a collection of properties or attributes
  • String – a series of alphanumeric characters, numbers, and punctuation marks
  • undefined – same as the null data type; default value for instances of the Object class
  • Void – special data type used to designate functions that don’t return a value

ActionScript 3.0 also adds two more data types:

  • int – a 32-bit integer between -231 and 231-1
  • uint – a 32-bit unsigned integer (either positive or zero) between 0 and 232-1

Continued in: