Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
June 30, 2008 - Submit Your Site for the July 08 Site of the Month Award!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 25, 2008, 05:12:47 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: MP3 help  (Read 627 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: 1063


« 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.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


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