Jump to content

Playing Music On Rollover - Stopping Onmouseout


richiej

Recommended Posts

Hi,I've been trying to play a swf music file on an event (onmouseover) and cannot get it to work. I want to play music when the cursor is on an image and stop it when the mouse moves off it. That was a failure so what i did was to embed the same music from "youtube". I shrunk down the image file from youtube and I intend to put it behind the image I want to use. This does not seem to be the proper way to do it. Is there a way to trap rolling over the image itself without going to youtube. I have the swf file and it plays OK but as I said, I cannot put it all together. The final problem is shutting it off onMouseOut. I can't figure that one out yet. This is the code:<body></param><embed src="http://www.youtube.com/watch?v=yrg5ztBkccw&hl=en&fs=1" style="Z-INDEX: 99; LEFT: 227px; POSITION: absolute; TOP: 63px" height="20"type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="15" height="17"></embed></body>PS: Putting the swf file in instead of the http statement causes the song to play as soon as the page loads - it doesn't wait to click on the URLThanks,Rich J.

Link to comment
Share on other sites

Any reason for the random </param> in the body?Also, the embed tag is not valid, I would suggest you use object instead.So, are you trying to play a music file, or a video? I'm not understanding you yet, sorry!

Link to comment
Share on other sites

Any reason for the random </param> in the body?Also, the embed tag is not valid, I would suggest you use object instead.So, are you trying to play a music file, or a video? I'm not understanding you yet, sorry!
Hi,Sorry - the "param" was probably a leftover from the copy/paste i made. I'm using Firefox so I thought that EMBED was legit to use. I gathered from one of the books I use for reference that you can use EMBED as long as you ALSO include OBJECT - a Firefox vs. Explorer difference.Anyway I trying to play a music file I have in SWF format generated from a test program downloaded from CNET -author is Hoo-Tech. (MP3 in - SWF out). That works fine. I can get the music to play but I can't associate it with a jpg image to play on rollover. Aside from that, how do you stop it on a OnMouseOut???Rich J
Link to comment
Share on other sites

<embed> is never correct.The correct way to put a flash document into the page is with the <object> tag. The following works for all browsers:

<object type="application/x-shockwave-flash" data="file.swf"><param name="movie" value="file.swf"><param name="AllowScriptAccess" value="always"><param name="AllowFullScreen" value="false">You need Flash Player installed to view this movie.</object>

If you want to make a sound play on rollover, I highly recommend programming that right in the Flash document. Trying to get Flash and Javascript to communicate requires more complex programming in ActionScript.

Link to comment
Share on other sites

If you want to make a sound play on rollover, I highly recommend programming that right in the Flash document. Trying to get Flash and Javascript to communicate requires more complex programming in ActionScript.
He's absolutely right. It's not too hard either, you can use LiveSwif to make the flash. (It's freeware: http://www.pryjon.com/liveswifers/forums/viewtopic.php?t=3)Just go to www.liveswifers.org and search for what you need to know, it's a pretty big community.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...