flawebdeb.com logo

 

Last update: 19-feb-03
 
Debbie Berg
Debbie Berg is a Web designer, a technical writer and a Web design instructor

Web Designer
Web Instructor
Technical Writer


Debbie Berg is a certified Macromedia Flash MX Designer
Consulting Services
Need help designing your Web site?
Is it time to redesign your Web site?
Is your Web site meeting your visitors' needs?
Want a site review to find out?
Need help marketing your Web site through the search engines?
Please contact me to discuss my fees
Flawebdeb Information

Check out Debbie's 2003 Training Schedule

Take a look at some
of Debbie's most recent clients

What are people saying about Debbie?

"I took your class in Phoenix. Loved it! You're a great instructor."

Erik Beckmann
Phoenix, AZ

"I attended your Dreamweaver and Flash seminar in Ft. Lauderdale.. Thank you for the help. I learned more in those hours with you than a semester at FAU where I'm a full time graphic design student."

Kaue Ribeiro
Ft. Lauderdale, FL

"Debbie Berg is the best professional instructor I have ever experienced. I have been involved in the Web field for over four years and have attended over 300 conferences and seminars, but Debbie's knowledge complimented by her expertise provided me with a new vision in Web development."

Lucie Rodgers
Baltimore, MD

"Debbie Berg is an excellent instructor. She is very knowledgeable and I will recommend any of her classes to those who are interested in Web design and development."

Michelle Kohl
Fredericksburg, VA

"Debbie did an excellent job of presenting complex Web technologies in simplistic language that was easy to understand. She also supplied several helpful "do's" and "dont's" that will be most helpful to our Web site."

Craig Hood
Jacksonville, FL

 

 

February 2003 DEB Tip

Back to DEB Tips

Flash MX: The Sound Object

Use the Sound Object to control sounds that are stored in the Flash Library as well as load sounds that reside outside the Flash movie. Controlling sounds includes starting and stopping the sound, adjusting the volume or the right and left balance while a sound is playing.

Object: a piece of data
Method: what the objects does

1. First, create a new Sound object. This is called instantiating an object. Select the first frame on the main Timeline and choose Window…Actions.

2. Then choose Actions…Variables…set variable. In the Variable field, enter the name of the new Sound Object. For example, enter “mySound” in the Variable field.

3. In the Value field, choose Objects…Movie…Sound…new Sound. Then check the Expression checkbox to indicate that this is a variable. Variables hold information.

4. After the new Sound object has been instantiated, associate a sound with the Sound object. Choose File…Import. Select a sound file to import and click Open. The imported sound is stored in the Flash Library.

5. Choose Window…Library and select the sound file. Then choose Linkage from the Options fly-out menu. The Linkage Properties dialogue box appears. Choose the Export for ActionScript checkbox. The name of the sound file should appear in the Identifier field. Click OK. Flash will export the selected sound with the identifier (the name of the sound file) so that it’s available to play when called upon by the Sound object.

6. Select the first frame on the main Timeline and select the existing new Sound () statement on the Actions panel to make sure that the next ActionScript statement will appear below it.

7. Choose Objects…Movie…Sound…Methods…attachSound. In the Object field, enter the name you gave your Sound object (ex: mySound).

8. In the Parameters field, enter the identifier (the sound file name) of your sound file within quotation marks. This tells Flash to look for a symbol with the literal name of the sound instead of using an expression that it must first evaluate to determine the identifier. The sound file is now attached to the Sound object.

9. After creating the new Sound object and attaching it to a sound from the Flash Library, use the start() method to play the sound and the stop() method to stop the sound from the Sound object. Use a button symbol to start and stop the sound. Choose Insert…New Symbol. Name the button “sound button” and choose the Button radio button. Click OK.

10. Choose the Oval tool from the Toolbox and set the fill color to a dark red and a stroke color to a dark blue. Set the Stroke height to 3 on the Property Inspector. Draw on oval shape on the Stage. This oval shape will serve as the button that will play the sound.

11. Select Scene 1 to return to the main Timeline and drag out an instance of the button symbol from the Flash Library onto the Stage. Use the Text tool to type the word “Play” over the button instance.

12. Use the Arrow tool to select the button instance on the Stage and choose Actions…Movie Control…on. This assigns an onRelease event handler to the play button. Event handlers are statements that perform actions as a response to events such as a click of a button.

13. Next, choose Objects…Movie…Sound…Methods…start. In the Object field, enter the name of the Sound object.

14. In the Parameters field, enter 0,5, where 0 represents the secondOffset and 5 represents loops. The secondOffset parameter determines how many seconds into the sound it should begin playing. The loops parameter determines how many times the sound will play.

15. To stop the sound from playing, use the stop() method. Drag another instance of the button from the Library onto the Stage. Use the Text tool to type the word “Stop” over the button.

16. Use the Arrow tool to select the button on the Stage and then access the Actions window. Choose Actions…Movie Control…on. This assigns an onRelease event handler to the stop button.

17. Then choose Objects…Movie…Sound…Methods…stop. In the Object field, enter the name of the Sound object.

18. Use the setVolume() method to change the sound’s volume. Drag another instance of the button symbol from the Library onto the Stage. Use the text tool to type the word “Volume down” over the button.

19. Use the Arrow tool to select the button on the Stage and choose Actions…Movie Control…on.

20. Then choose Objects…Movie…Sound…Methods…setVolume. In the Object field, enter the name of the Sound object.

21. In the Parameters field, enter the number 40, where the volume value is based on a scale of 1-100.

22. Drag another instance of the button from the Flash Library onto the Stage. Use the Text tool to type the word “Volume up” over the button.

23. Use the Arrow tool to select the button on the Stage and choose Actions…Movie Control…on.

24. Next, choose Objects…Movie…Sound…Methods…setVolume. In the Object field enter the name of the Sound object.

25. In the Parameters field, enter the number 90. Close the Actions window.

26. Choose Control…Test Movie to test the sound.

Source: This lesson was developed especially for YOU by Debbie Berg  :-)

WATCH FOR MORE DEB TIPS TO COME! STOP BY AND SEE MY NEW DEB TIP EACH MONTH...

To learn more about WordTracker, click here

Back to top

about debbie | debbie's clients | deb's schedule | deb's monthly tip
flawebdeb home | dreamweaver | flash | frontpage | photoshop
web seminar | digital design camp | dreamweaver/flash conference

 

 
D.E.B. Tips
 
 
 Dreamweaver
 Flash
 Frontpage
 Photoshop
 Web Seminar
 Web Marketing
Web Images
 Digital Design Camp
 Dreamweaver/Flash
 Conference