Iulie 04, 2025


Learning To Use Tell Target ActionScript

 

Before We Begin
This tutorial is going to discuss the use of the TELL TARGET actionscript command. Before beginning the first lesson, take a moment to play with this sample flash movie below that demonstrates the basics of TELL TARGET.

 
 

Understanding TELL TARGET

1. To flash animators who are not programmers, actionscript can seem overwhelming. In such a case, the best way to understand actionscript is to see the big picture.

2. Looking at the flash sample bellow, you see that there are two modes in which the face can exist: Happy or Sad.

3. You also see that there are only two components in this simple demonstration. The face component (item 1) and the buttons component (item 2). The face movie

4. The relationship between the components is simple. The buttons tell the face what to do. This is one of the basic functions of actionscript: telling other symbols (targets) what do to, an excellent reason to call this command TELL TARGET.

 
 

Telling What You Want What You Really Really Want
(sorry, could not resist)

Let's talk about programming now.

The following is the actionscript for button that makes the face happy.

On (Release)
Begin Tell Target ("/face")
Go to and Stop ("happy")
End Tell Target
End On

 

 

 

- When interpreting the code above it is important to read it back to yourself in simple English. Notice that the colors in the code above match the words in the sentence below. For example,

- "When you click and release with the computer mouse on this button, you should tell the target movie clip named 'face' to go to the frame labeled 'happy' and then stop."

- Reading actionscript to yourself will help you see what exactly your code is going to do in your flash movie.

 
 

Creating The Target Movie Clip

In the movie clip that will be controlled by the button, we must first label the frames to which we want to jump by command.

 
 

Adding Actionscript To The Buttons

Now that we have talked about adding actionscript, we should actually do it.

To add the following script:

On (Release)
Begin Tell Target ("/face")
Go to and Stop ("happy")
End Tell Target
End On

 
 

1. Double-click the button. The Properties window appear. Click on the Actions tab to reveal the actionscript box area.

 
 

2. Next, click on drop-down menu and select Tell Target . By clicking on Tell Target, you have begun to tell the button to do something.

Recall the sentence in a previous section. If you were to read this actionscript now, it would say: "You have told it to tell something to go somewhere after the mouse button has been clicked and released." We will defined something and somewhere in the proceeding steps.

Since you have assigned an instance name to the 'face' movie clip, an icon will appear in the box to the right

 
 
3. Double-click on the icon. It will add your target's name to the code. In this case, the target is "/face".

So, now you are telling 'face' to go somewhere after the mouse button has been clicked and released.

Now, you are ready to define somewhere.

 
 

4. Use the dropdown menu again, then click on Go To .

When you selected Go To, you will that the default command instructs the movie to Go To and Stop at Frame 1.

 
 

5. Change the command to instruct the movie to Go To and Stop at a Frame labeled 'happy'.

Repeat the steps 1-5 for the sad button.

On (Release)
Begin Tell Target ("/face")
Go to and Stop ("sad")
End Tell Target
End On

 

 

 

Your done. Good job!


The full clip

Download the .fla file

Download the .swf file


This tutorial is a part of the primezero.com