PDA

View Full Version : SWFObject - Only 15 Instances Allowed?


Superman859
12-12-2006, 02:40 AM
Hello everyone. I've run into a strange problem - not too sure what it is.

I have a page that contains a bunch of buttons that play audio files. I set it up with Actionscript so that I can send the name of the file to the swf file via HTML, allowing me to use the same swf file for each button.

What I do is use the following code as instructed...

<div id="fv13"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so = new SWFObject("../flash/small_button_template.swf", "fv13", "24", "24", "8", "#ffffcc");
so.addVariable("audioName","audio/fv13.mp3");
so.write("fv13");
</script>

I simply change the so.write() and div id for each new copy of the button.

What seems to happen is when I hit 16 (fv13 corresponds to the 13th use of the swf file, calling of a new SWFObject, etc) it just doesn't work anymore.

If I have 15 copies of the button with different audio files on one page, it works flawlessly. It loads fast, and loads the audio fast when you click a button.

When I have 16 or more, it doesn't. I click to play a sound and nothing happens. I click around some more and eventually it starts playing portions of the audio clips, but not necessarily the correct one.

Is there a limit? Perhaps you can only create so many instances in Javascript or using SWFObject? I just don't know what is going on in the background, so I am not really sure what is going on.

To view the problem, check out the following two pages...

www.learn-korean-now.com/beta/sample1.php
www.learn-korean-now.com/beta/sample2.php

Sample 1 only has 15. I removed the 4th one (just by random, removing any of them makes it work, so it isn't a problem with the 4th button/audio file).

Sample 2 has 16 instances of it.

Edit: New discovery - it counts across all pages that are currently open as well. I had sample1 open along with sample2, and it would not work. When I close sample2 and have sample1 open by itself, it works just fine. This still goes along with having more than 15 instances (since it would have 31 with them both open).

Edit: Newer discovery - Both work great in IE6. Firefox is having the trouble.