Not signed in (Sign In)

Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthordrpudding
    • CommentTimeFeb 3rd 2008 edited
     
    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.

    swfobject 1.5
    Netscape 9
    Firefox 2

    Marc
    • CommentAuthorAran
    • CommentTimeFeb 3rd 2008
     
    It's a know bug with Firefox, that if you have more that 15 simultaneous flash files with audio = kaboom. See more here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=289873

    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).

    Regards,
    Aran
    • CommentAuthordrpudding
    • CommentTimeFeb 3rd 2008 edited
     
    Thank you very much for the explanation.

    I'm assuming that something like this is what you mean:

    <img src='listen.gif' border='0' alt='listen button' onClick='so335054.write("335054");'>

    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'?

    M
    • CommentAuthorAran
    • CommentTimeFeb 5th 2008 edited
     
    So you have two options really.

    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");
    }

    <img src='listen.gif' border='0' alt='listen button' onClick='setFlash("audio.swf", "338610");'>


    make sense?

    Aran
    • CommentAuthordrpudding
    • CommentTimeFeb 5th 2008
     
    Yes. Makes sense.

    In the end, I may be splitting the tones into multiple smaller pages for categorization reasons, but I suspect I may use #2 sooner or later.

    Again, Thank you much for all the help.

    Marc