Web Hosting Forum | Lunarpages
News: Server Migrations to San Diego: Deneb, Felix and Tsohea are moving to San Diego starting Tuesday, December 30, 2008 at 10pm Pacific. They will complete their moves Friday night, January 2, 2009

Isis, Seth and Ez-web-n-mail will move physically on Friday, January 2, 2009

Please see the forum posts at http://www.lunarforums.com/lunarpages_web_hosting_server_information-b54.0/

+ Submit Your Own Web Site for the January 2009 Site of the Month Contest!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 09, 2009, 04:54:49 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: MP3 help  (Read 685 times)
JaneFinch
Newbie
*
Offline Offline

Posts: 4


« on: January 28, 2007, 09:42:58 AM »

I have buttons and roll over effects.

But I dont know how to add mp3's (my own production) to the existing code.

I'm using Flash 8

Any help would be greatly appreciated.

J/F
Logged
philvis
Master Jedi
*****
Offline Offline

Posts: 1064


« Reply #1 on: January 28, 2007, 12:13:54 PM »

You can attach sounds to the button with the method below.

If the mp3s are fairly large, you might want to stream them instead using the loadSound method instead of sound.start.

From the Flash8 help files for importing a sound and attaching it to a button:

Quote
To attach a sound to a timeline:
Select File > Import to import a sound.
Select the sound in the library, right-click (Windows) or Control-click (Macintosh), and select Linkage.
Select Export for ActionScript and Export in First Frame; then give the sound the identifier a_thousand_ways.
Add a button to the Stage and name it play_btn.
Add a button to the Stage and name it stop_btn.
Select Frame 1 in the main Timeline, and select Window > Actions.
Add the following code to the Actions panel:

var song_sound:Sound = new Sound();
song_sound.attachSound("a_thousand_ways");
play_btn.onRelease = function() {
    song_sound.start();
};
stop_btn.onRelease = function() {
    song_sound.stop();
};


This code first stops the speaker movie clip. It then creates a new Sound object (song_sound) and attaches the sound whose linkage identifier is a_thousand_ways. The onRelease event handlers associated with the playButton and stopButton objects start and stop the sound by using the Sound.start() and Sound.stop() methods, and also play and stop the attached sound.
« Last Edit: January 28, 2007, 12:26:03 PM by philvis » Logged

JaneFinch
Newbie
*
Offline Offline

Posts: 4


« Reply #2 on: January 28, 2007, 03:51:43 PM »

Thanks philvis.

Can I attach this to the existing code? So I wont affect the roll over effect on the buttons.

How do i get the mp3 to play when pressed.

J/F
« Last Edit: January 28, 2007, 04:16:27 PM by JaneFinch » Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM