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

Hour 13. Making Buttons for Your User to... > Task: Create a Button with Looping S...

Task: Create a Button with Looping Sound

Edit the master button we created in the previous Task. If you aren't already inside the master button, double-click the instance of the button.

Select the keyframe in the Over state. In the Loop field of the Properties panel, type a very large number such as 999999999999999 to get to the highest possible number. (See Hour 10 for more information on this.)

Test the movie now. There are some problems. The sound Breaker Switch doesn't loop well. However, that's the least of the problems—and one that could easily be rectified with an alternative sound. The serious problems that we'll address are (1) the sound will layer on top of itself every time you roll off and then roll back on the button, and (2) when the sound starts, it never stops.

You might recall from Hour 10 that three other Sync settings exist besides the default Event. We want the sound in our Over state to only start playing if it isn't already playing. In the master Button symbol, set the Sync setting for the sound in the Over frame of the button to Start (that is, while the frame is selected, use the Properties panel to select Start from the Sync drop-down list). Test the movie again, and you'll see that we fixed the issue of the sound starting again after it has already started.

But the sound still never stops once started. The opportune time to stop the sound is when the user rolls off the button—the Up state. There happens to be an Action called stopAllSounds; however, recall that we don't put Actions inside of buttons—besides, what if we want other sounds to continue playing? We only need the particular sound that's looping to stop. In the Up state's keyframe, we add the same sound. But this time, select Sync Stop, which will cause only that particular sound to stop. To do this, select the first keyframe (in the Up state), then from the Properties panel, select the same sound we're using in the Over state (“Breaker Switch”) from the drop-down list of sounds available, and set the Sync to Stop. Test the movie and it should work.

Invisible Buttons

Invisible buttons are very useful. They're easy to make, too, as you'll see in the next task. Flash will let you (the author) see the invisible button as semi-transparent blue. The user won't see anything.



Not a subscriber?

Start A Free Trial

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