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


STEP 09 coding the BUTTON

Now that the movie clips are in place, we need to tell them what to do and when. For a basic rollover, the coding is fairly straightforward:

  • When the user's pointer moves over the hit area, stop playing filmclip1 and begin playing daveclip1.

  • When the user's pointer moves off the hit area, stop playing daveclip1 and resume playing filmclip1.

I guess I've stressed the logic of this button enough at this point….

To add the necessary actions for controlling the rollovers, follow these steps:

Lock all layers except the button layer by pressing Alt / Option while clicking on the button layer lock control as shown in figure 04:21.

Figure 04:21.

Select the keyframe in the button layer and choose Modify > Instance again.

In the Instance Properties dialog, select the Actions tab.

Select the Add Action button (the plus sign) and choose On MouseEvent.

The initial code is written into the list window and the On MouseEvent options appear to the right in the Parameters pane.

Select the Roll Over checkbox from the On MouseEvent options and uncheck the Release checkbox (see figure 04:22).

Figure 04:22.

Remember, on rollover, the first thing you want to happen is to stop filmclip1 from playing. To do this, you must first specify that clip as the one you want to control via the Tell Target action.

Click the Add Action button and select Tell Target. When you do this, the names of the available targets, the two movie clips, appear in the Parameters pane.

Double-click the filmclip1 target.

The filmclip1 label is added to the Tell Target code as shown in figure 04:23.

Figure 04:23.

After you've found the proper target, it's time to specify the action(s).

From the Add Action button, choose Go To.

The initial action is to stop filmclip1 from looping.

In the Go To Parameter pane, select the Label option and type in filmstop (see figure 04:24).

Figure 04:24.

The second part of the onMouseOver event is to start the second movie clip playing. You insert actions identical to those just created; however, the actions have different parameters.

Select the script line End Tell Target.

You can't put one Tell Target inside another, so you have to be sure to add a second Tell Target directly after the first.

Repeat steps 6–10, changing the parameters like this:

  • For Tell Target, choose daveclip1.

  • Rather than the Go To action, select the Play action.

The resulting code should look like that shown in figure 04:25.

Figure 04:25.

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