I have a simple swf file that plays an audio (mp3) file when you select it. I have several of these on a ringtones sampling page. Everything works fine on most browsers, however on Netscape and Mozilla on a PC I'm having an odd problem where I am able to embed 15 swf files on a page, but when I embed #16, none of the audio plays. The movie does play, but no audio comes forth. I am scratching my head, since I assume that nothing is loaded memory-wise until an actual movie is selected, correct?
Here is a sample of the embed code. Again, this works until I add one additional embed...
<div id='335054'>No flash.</div> <script type='text/javascript'> var so335054 = new SWFObject('audio.swf', 'ringtone335054', '63', '15', '6', '#ffffff') so335054.addVariable('audio', '335054'); so335054.write('335054'); </script>
<div id='338610'>No flash.</div> <script type='text/javascript'> var so338610 = new SWFObject('audio.swf', 'ringtone338610', '63', '15', '6', '#ffffff') so338610.addVariable('audio', '338610'); so338610.write('338610'); </script>
Thanks for any help! I'm relatively new to using swfObject, so may be missing something basic.
My suggestion (as was my suggestion to the last person on this forum with the same issue), is to only load the swf / audio when the user actually clicks to listen. The user will not want to listen to all 15+ sounds at once, so don't load them all at once.
You can use javascript etc to create the swfObject when the user clicks a button/ link (there are many posts on the subject on the forum already).
As successive objects are created, would the 16th and beyond still load...assuming they click and load every one on the page? Or do I need to 'unload' objects'?
1) use an iframe, and rewrite the contents of the iframe based on the mp3 selected. This way you will only ever have 1 swf at a time
2) use a javascript function to rewrite the contents of the div (which is what I alluded to on my last post). Below is a rudementary example. I think Geoff might have said this leads to a bit of a memory leak (ie, more RAM is used as you swap again and again) on some browsers, but I know it works to swap out content.
function setFlash( loc, audioid ) { var so = new SWFObject(loc, 'audioswf', '63', '15', '6', '#ffffff'); so.addVariable('audio', audioid); so.write("flashcontent"); }