A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11337 Flash Movies | 1 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5828 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.


Random Links | Add your own Flash Related Links
Flash Tutorials 1280 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make a Flash Slide Show Screen Saver
» Simple flash making tutorial for thanksgiving
» Create flash banner for website
» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» Unknown Tag: Title10
Random Tutorial | Add Site

Trading Customer Accounting (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Audio

Categories How to Use Flash MX Sound Objects
Author: Kenny Bellew | Website: http://www.cowfly.com |

 
Page 3
«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... next»

How to Define a Sound Object Using the attachSound Method

When utilizing sound objects, the sound is never dragged from the library onto stage or placed in a frame. This is true whether you use the attachSound (for embedded sounds) or the loadSound method (for external sound files). The sound is defined in a frame or movie clip and an identifying name is attached to the sound while it resides in the library (except in the case of loading an external MP3).

For this section of the tutorial, "firstSound" will refer to the name chosen for the instance of the sound object. Similarly, "firstSound01" will refer to the identifying name inserted in the linkage properties of the sound file that will be imported into the Flash library.

firstSound=new Sound();
firstSound.attachSound("firstSound01"); 
______________________________
Fig. 01: Sound object defined
  1. Import one or more sound files into the Flash library by selecting "File" and then "Import to Library."

  2. Right-click (Windows) or control-click (Mac) on the sound file within the library and select "Linkage..."

  3. Select "Export for Actionscript" as shown in Fig02.

  4. Fig.02: Linkage properties for a sound file
    in the library.
  5. Type in an identifier for the linkage ID.

    The identifier, which, in this example, is firstSound01, must be unique. It should not be the same as your sound object instance name or any other identifier in your movie.

  6. Decide where to define the sound objects.

    If the sound objects are defined all on the same level, it simplifies affecting the sound object later. For example, if the sound is defined at the _root level and then is to be started by pressing a button within a movie clip, the code would appear as follows:

    on (press) {
    _root.firstSound.start();
    }


    If each sound object is defined in different movie clips and then used elsewhere, the unique path to the sound object will need to be remembered. If the sound is only being used once, this is irrelevant.

    When a call is made to the sound object, the complete path to the location where the sound object is defined will need to be spelled out in the ActionScript. For example, if the sound object is defined in a movie clip named "mc02" which is in another movie clip called "mc01", the ActionScript would appear as follows:

    on (press) {
    _root.mc01.mc02.firstSound.start();
    }

    The following is one of the most important things to remember about your sound objects. When a sound object is attached using the attachSound method (as is being described here), the sound will load, by default, as a child of whichever movie clip in which the sound object was defined. However, a sound object can be assigned as a child of any movie clip, regardless of where it is defined. This is important because any call to a method of a sound object, such as setVolume, will affect all sound objects which are the child of the same movie clip. This will become more clear when you need to manipulate the methods of multiple sound objects. Manipulating multiple sound objects is described in the section: How to Control Independent Sound Objects Simultaneously.
  7. The ActionScript for defining your sound object will appear as in Fig.01.

    firstSound=new Sound();
    firstSound.attachSound("firstSound01");

In this example, the chosen sound object instance name is "firstSound". In the second line, the instance name of "firstSound" is attached to a sound file in the library by specifying that sound's linkage identifier, "firstSound01," which was created in the above step 4 and illustrated in Fig.02.

Your sound object is now defined and ready to be called into action.

Note: Never start the name of your sound object or linkage ID with a number.

«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... next»

» Level Intermediate

Added: : 2004-10-12
Rating: 8.48 Votes: 31
Hits: 1290
» Author
Kenny Bellew is a technical writer and freelance flash programmer who specializes in Flash audio. He lives in Minneapolis, MN.
» Download
Download the files used in this tutorial.
Download (12927 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs