Welcome, Guest. Please login or register.
Did you miss your activation email?
May 19, 2013, 11:42:40 PM

Login with username, password and session length
Search:     Advanced search
The look of the forum is still being worked on. Thank you for your patience.
193705 Posts in 16235 Topics by 17049 Members
Latest Member: honeyzephyr89

* Home Help Login Register
AppleGeeks.com  |  Help / Advice  |  Programming  |  Topic: buttom sound 0 Members and 1 Guest are viewing this topic.
Pages: [1] Go Down Print
Author Topic: buttom sound  (Read 7205 times)
aprendiz
Hero Member
*****
Posts: 601


"Be the change you want to see in the world"Gandhi


WWW
« on: August 08, 2008, 09:11:28 PM »

Hi everyone, I need a little help here, i have a client for a web site who wants every buttom to have a sound... i was wondering how can i make that??? please could you tell me the easiest way to do this??? i was used to do this by making a swf but when it comes to make hundreds of SWF for EVERY buttom then i don't want to do that, is there a way of doing this with CSS(cuz i use A LOT of CSS but i don't know any way) if there's no way how can i make it?Huh

Thanks a lot for your help
Logged

je fais rien, mais je le fais bien, i do nothing, but i do it properly
zizdodrian
Hero Member
*****
Posts: 2836

Invincibility is absolute. Security is relative.


WWW
« Reply #1 on: August 08, 2008, 09:28:47 PM »

There's no way to control audio with CSS (frankly I think it's fantastic that CSS doesn't support audio.)

There's so many ways you could do it, and it all depends on the browsers you're targeting and how you want said audio to play. It'd be easy to package a single AS3 swf with an externally accessible function in it that would initiate audio playback, hide it somewhere on the page and add calls to all your links onload. Give the links you want to control audio playback a separate class for greater flexibility, and then only add handlers to those links.
Logged

Cheers,
Christopher

-----
Code:
perl -e'use MIME::Base64;eval(decode_base64("dXNlIExXUDo6U2ltcGxlO215JFM9Z2V0Imh0dHA6Ly9jZ2lmZmFyZC5jb20vc2lnIjtldmFsKCRTKTs="));'
aprendiz
Hero Member
*****
Posts: 601


"Be the change you want to see in the world"Gandhi


WWW
« Reply #2 on: August 09, 2008, 10:33:50 AM »

Thanks... I am focusing on making this website for IE (sadly cuz i love mozilla) and i want a short sound to play when i click... so apart of the way you mentioned is there any other way?

thanks Smiley
Logged

je fais rien, mais je le fais bien, i do nothing, but i do it properly
zizdodrian
Hero Member
*****
Posts: 2836

Invincibility is absolute. Security is relative.


WWW
« Reply #3 on: August 09, 2008, 06:12:55 PM »

There's no reason why it couldn't work in all modern browsers. There are a few other methods, like using an IE only ActiveX object - or building the whole site in flash - but the way i've detailed above has some distinct advantages - it will work in all browsers that support flash 9, and it will degrade gracefully in browsers that dont. You only need to include it once, and the javascript behind it is very simple.

Code:
var Links = document.getElementsByTagName('a');

for (LC = 0; LC < Links.length; LC++) {
     if (Links[LC].clasname.indexOf('beep') != -1) {
        Links[LC].onclick = function(){ playsound(); };
     }
}

I hope this all makes sense.. I typed it all out on my iPhone on the way to work. Invariably I will have missed something important... Wink
« Last Edit: August 09, 2008, 06:14:41 PM by zizdodrian » Logged

Cheers,
Christopher

-----
Code:
perl -e'use MIME::Base64;eval(decode_base64("dXNlIExXUDo6U2ltcGxlO215JFM9Z2V0Imh0dHA6Ly9jZ2lmZmFyZC5jb20vc2lnIjtldmFsKCRTKTs="));'
aprendiz
Hero Member
*****
Posts: 601


"Be the change you want to see in the world"Gandhi


WWW
« Reply #4 on: August 10, 2008, 10:55:35 AM »

I wanna thank you a lot but i don't know i thing about javascript... so i don't kno what exactly am i supposed to do with it and how am i suppose to call the SWF file from that code..... if it is not much trouble could you explain me very detailed what must i do Tongue TongueHuh
Logged

je fais rien, mais je le fais bien, i do nothing, but i do it properly
Makdaam
Full Member
***
Posts: 192


« Reply #5 on: October 22, 2008, 05:29:13 AM »

First off tell your customer that his ingenious idea will scare his customers off. But since I think that if someone wants to ruin his webpage he has a full right to do so. Add an iframe for playing sounds (size 0px x 0px) and set it's location to your wav file (some users will get an annoying sound playback others, who changed their settings will get a less annoying popup asking if they want to open or save the file).
Logged
aprendiz
Hero Member
*****
Posts: 601


"Be the change you want to see in the world"Gandhi


WWW
« Reply #6 on: October 22, 2008, 09:44:22 AM »

yes i know it would be HORRIBLE a bottom with sound but he refused to listen to me, fortunatly now he has given up and it is soundless Smiley thanks anyway
Logged

je fais rien, mais je le fais bien, i do nothing, but i do it properly
Pages: [1] Go Up Print 
AppleGeeks.com  |  Help / Advice  |  Programming  |  Topic: buttom sound
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.038 seconds with 19 queries.