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

Hour 16. Using Components > Task: Add a Homemade Property

Task: Add a Homemade Property

In this task, you'll create a property that can vary in each instance of the Component. Here are the steps:

Inside Clip containing Circle Clip, select the clip instance of Circle and open the Actions panel. Change the line _x=_x+10 to _x=_x+speed, as shown in Figure 16.7.

Figure 16.7. You can change your “hard-wired” 10 to a made-up property that varies in each instance.

While you're inside Clip containing Circle Clip, create a block of text (right next to the clip of Circle). Type 0 in it as a placeholder. From the Properties panel, change the Text Type to Dynamic and associate it with the variable “speed”, as shown in Figure 16.8. Also, make the margin big enough because speed (the contents of this field) will reach the double-digits.

Figure 16.8. Creating a dynamic text block right in the soon-to-be Component allows you to monitor the value of the property.

You're going to make a Component that allows the using author to change “speed” for each instance. Before that, though, you'll get it working by hard-coding some numbers.

Go back to your main scene and remove all instances of Clip containing Circle Clip. Then drag one fresh from the Library. Name this instance oneClip in the Properties panel. Now, select the first keyframe and open the Actions panel so that you can place an Action that executes right from the start. All you want to do is set the “speed” property for the one instance on the Stage (and see whether it works). Therefore, with the first keyframe selected, type the following code into the Actions panel:


(Notice that this is the same format as setting any other property—such as alpha—but “speed” is a homemade property.)

Test the movie. Although it doesn't move the clip across the screen, you should see the field containing the “speed” variable display the correct value (10).



Not a subscriber?

Start A Free Trial

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