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

Hour 16. Using Components > Task: Make the Start of Your First Component

Task: Make the Start of Your First Component

This task lays the groundwork for the Component you're going to build. Follow these steps:

1.
Draw a circle, convert it to a symbol called Circle, and make sure that it has the Movie Clip behavior. Select the clip you just created and convert it to a symbol. Call it Clip containing Circle Clip and make it a Movie Clip, too.

2.
On the Stage, you should have an instance of Clip containing Circle Clip. Double-click it, and you'll be editing the master symbol. Inside this symbol, you should have an instance of Circle. Single-click this instance to select it, access the Actions panel, and insert a clip event Action (Esc, O, C). Select enterFrame from the clip event choices listed. Go to the end of the first line of code (after the open curly brace “{“) and insert a new line, then type _x=_x+10. See Figure 16.5 for the finished version. The enterFrame event occurs every time your Timeline goes to a new frame. If your movie is running at 12fps, this event occurs 12 times a second.

Figure 16.5. Selecting the clip event enterFrame makes the Circle (inside Clip containing Circle Clip) move 12 times a second.


3.
Right after the line _x=_x+10, insert an “if” Action (found under the plus button, Actions, Conditions/Loops). The parameter for “if” is the condition that has to be true for the code that follows to execute. In the condition field Of the Parameters, type _x>550. Next, insert a new line and then type _x=0. The result should look like Figure 16.6.

Figure 16.6. The finished version of the script attached to the Circle instance.


4.
Save your file—you'll build on it later. Test it out!


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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