• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 23. Learning How to Learn Flash > Task: Use the Trace Action to Confirm a ...

Task: Use the Trace Action to Confirm a Script Is Working

This task simply tests the trace Action. Here are the steps to follow:

1.
In a new movie, draw a circle, convert it to a symbol named “Circle”, and make sure it's a Movie Clip. Give the instance onstage the instance name “ball” via the Properties panel.

2.
In the first frame, insert an Evaluate action (press Esc, E, V) and then type ball._x=_xmouse.

3.
Test the movie. You might expect the ball's x property to move as you move the mouse, but it doesn't.

4.
Back in the first frame, insert the trace Action (press Esc, T, R) and type moved it in the Message parameter. Test the movie, and you should see the output window pop up with your message from the trace Action. However, the problem is that you want the ball's _xproperty to keep changing as the movie plays, but it only happens once (as does the trace function).

5.
In the movie, insert a frame at frame 2 (click frame 2 and press F5). Now when you test the movie, you'll see the “moved it” text appear repeatedly in the output window. Actually, when trace is used in this manner, it becomes distracting, but at least this time you solved the problem. Note that there are other ways to make a clip follow the mouse—such as placing code within the mouse move clip event. This is explained at the end of the Workshop section of this chapter.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint