Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5

Thread: Music in flash

  1. #1
    Senior Member iphong's Avatar
    Join Date
    Mar 2003
    Location
    Arlington, VA
    Posts
    751
    Member #
    916
    I would like to know something about flash!
    How can make a button that play and stop a sound file in the library.
    Thank!
    Vu Tuan Phong
    iPhongDesign

    http://iphong.com
    http://adstudio1.com

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Make a Button symbol. To do this, create a graphic, highlight it, and press F8. This will allow you to make the graphic into a symbol. Select "button" as the symbol type.

    Then right click on the button, and select "actions". Press Ctrl+E to enter "Advanced Edit Mode", and paste in the following code:
    Code:
    on (release) {
      startStopSound();
    }
    Then close the Actions window. Create a new layer called "Sound". Right click on the first frame in that layer, and click "Actions". Hit Ctrl+E to enter advanced edit mode and paste this code:
    Code:
    var sound = new Sound();
    var soundStarted = false;
    
    sound.attachSound("idName");
    
    function startStopSound() {
    	if (!soundStarted) {
    		sound.start();
    		soundStarted = true;
    	} else {
    		sound.stop();
    		soundStarted = false;
    	}
    }

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    replace "idName" with the Library id of the sound that you have imported.

  5. #4
    Senior Member iphong's Avatar
    Join Date
    Mar 2003
    Location
    Arlington, VA
    Posts
    751
    Member #
    916
    O I C. Thank you very much i have got it.Im on my way in Flash design.
    Vu Tuan Phong
    iPhongDesign

    http://iphong.com
    http://adstudio1.com

  6. #5
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    You can also add scripting in the startStop function to change the button from a start button to a stop button, so that the user can see a change.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:44 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com