Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Only 15 instances allowed for Javascript (for Firefox)?

    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 (flash) that play audio files. I set it up with Actionscript so that I can send the name of the file to the Flash 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...

    Code:
    <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, which works.

    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 on how many calls to a Javascript file you can make? 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 - Problem only occurs in Firefox. Works great in IE6
    Last edited by Superman859; 12-12-2006 at 04:38 AM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You can't use the same variable names over and over. Start adding a number on the end
    Code:
       var so1 = new SWFObject("../flash/small_button_template.swf", "fv01", "24", "24", "8", "#ffffcc");
       so.addVariable("audioName","audio/fv01.mp3");
       so.write("fv01");
    var so2 = new SWFObject("../flash/small_button_template.swf", "fv02", "24", "24", "8", "#ffffcc");
       so.addVariable("audioName","audio/fv02.mp3");
       so.write("fv02");
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, perhaps that was it.

    I had decided to look into it more, and the error only occured in Firefox 1.5. I updated to Firefox 2.0 and it worked fine (without changing anything).

    I will go back and change variables and see if that fixes it for Firefox 1.5. Everything other than Firefox 1.5 works fine without making any changes - I wonder why that is.

  • #4
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well I tried it out, and that doesn't seem to be the problem.

    Firefox is still having trouble playing the audio clips correctly.

    Sample Page

    The sample page works great in IE (and Safari I believe), but in Firefox it will not play correctly. I'm using Firefox 2.0, and have also checked it in Firefox 1.0. Last night it worked in Firefox 2.0 with the same variable name, but now that I've changed it, it's not working. I have no clue what is going on.

    I went through and gave each variable a unique name, yet it still has trouble.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I'm using FF1.5.0.8 and I went through each sound file and they all worked fine.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's so strange. Did you have to wait at all?

    The page loads fast for me, but the audio won't work. I test it on my desktop computer in Firefox 1.0.4 and laptop with Firefox 2.0 and it doesn't work (both Windows XP). That proves it's not connected to one computer, and I've also done it on two separate networks.

    I don't know how it would not work in 2.0 but does in 1.5.

    I guess I will need to look into it more and see what's going on.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •