Jump to content

playsound when receive message


razaviv
 Share

Recommended Posts

hello, want that if someone receive message in chat from other poeple he will receive a notice like facebook, some sound that will be easy that will tell him he has new message. so when someone send message he automaticly updates the database so the other poeple will have sound, when the other poeple has sound, he call for ajax function which checks it and if there is a sound it runs a function that gives the sound and update to no sound at database.my question is how to do the javascript call for sound so it will works great.the prbolem: while it runs the sound it just minimize all the task of the browser are opened - i will explain:if you on some text (such the input to wrtie to your friend) it will blur you from it, play the sound, and focus you on it again. i wont it happens. i want the focus to stay anyway. and also its so controliest that if you even use the media player watch movie and someone sent you message its will minimize your media player!so if someone knows how to solve this problem or give some good solution, thanks.oh and if it calls to javascript forum im sorry, please pass it than.

Link to comment
Share on other sites

I can't say what the problems are with your current setup without seeing the code you're using. If what you're doing is not working for you, then one option is to embed a transparent Flash movie that you can communicate with through Javascript to have it play various sounds.

Link to comment
Share on other sites

I can't say what the problems are with your current setup without seeing the code you're using. If what you're doing is not working for you, then one option is to embed a transparent Flash movie that you can communicate with through Javascript to have it play various sounds.
it works, but it just blur the input when receive a message.that means that it plays the sound but its also blur the input and i didnt find anyway to involve it.. i tried put the input in iframe but it wont helps because it still on the same page altough its iframe.. how can i play the sound of message no blur inputs? if with flash and js how then?thanks.
Link to comment
Share on other sites

You make a Flash movie with your sounds embedded in it, with Actionscript functions to play whatever sound you want. There are several techniques for communicating with Flash using Javascript, so you would use Javascript to send a message to the Flash movie that you want it to play a sound. I don't know of any way of doing this other than to build the Flash movie yourself. I don't think you're going to find one ready-made which will do exactly what you want it to.

Link to comment
Share on other sites

You make a Flash movie with your sounds embedded in it, with Actionscript functions to play whatever sound you want. There are several techniques for communicating with Flash using Javascript, so you would use Javascript to send a message to the Flash movie that you want it to play a sound. I don't know of any way of doing this other than to build the Flash movie yourself. I don't think you're going to find one ready-made which will do exactly what you want it to.
i just want to display sound when receive message as facebook..
Link to comment
Share on other sites

Yes, I understand what you're trying to do. What do you think Facebook did, do you think they posted on a forum and asked how to do it, or do you think they have people who can do things like make a Flash movie?
well i found a swf sound file but it wont work to run it:
<object width="400" height="40"<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"><param name="SRC" value="http://www.booknick.info/data.swf"><embed'>http://www.booknick.info/data.swf"><embed src="http://www.booknick.info/data.swf" width="400" height="40"></embed></object>
tell me please what doesnt clear it so it wont works.thanks
Link to comment
Share on other sites

You make a Flash movie with your sounds embedded in it, with Actionscript functions to play whatever sound you want. There are several techniques for communicating with Flash using Javascript, so you would use Javascript to send a message to the Flash movie that you want it to play a sound. I don't know of any way of doing this other than to build the Flash movie yourself. I don't think you're going to find one ready-made which will do exactly what you want it to.
Have you made any steps towards learning a few things about Flash and ActionScript? There are lots of tutorials available on Flash, and importing a few sounds into a flash movie shouldn't be too hard.What I would suggest is to read online, post in the Flash forums if you have trouble, till you have learned enough about Flash to create a simple .swf that has sounds that you can trigger with Javascript. Once you have gotten that far, then try learning how to trigger Flash events with Javascript. If you are having trouble at this point, then it would be relevant to post your code back in this thread and more help can be undertaken to help you out. You just have to take it one step at a time.
Link to comment
Share on other sites

well, im not a flasher so i searched at google for some swf, maybe because of this its wont play the sound..so probably the way that w3schools posted in the article - the code i posted here - should work, now i just need some sound..can you give me link of site that includes good sounds? that will work? or maybe send me one swf byurself? i dont think its hard make such a sound...i just dont have flash on my pc.. thanksi downloaded the file form here:http://www.flashkit.com/soundfx/Interfaces...D-145/index.php

Edited by rjy9aen2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...