I am working on a script for allowing people on my arcade to put the game code on their site/myspace. It uses a CGI script to add the correct game information into the javascript. On page load the javascript hides the game in a div and displays a "Provided by" image with my arcade's name on it. After 6 seconds it hides that and shows the game. Here is my test page http://www.kingdomarcade.com/test-share.html The problem I am having some games have sound playing on the main menu. That would prevent people from putting multiple games on one page because of the annoying sounds. I have tried adding <param name="audio" value="false" /> to the HTML and the sound is still there. Is there a way to do it using javascript or is there a different param I should be using. This is very important because I am thinking about selling ad space on it in the future that will show for the 6 seconds instead of my image.
I've just sort of messed around with this, so I apologise if it isn't too clear... What I used was a div, and as the document loaded, call a function (mine was countdown). This would count down from 10, and when it hit zero, it'd build the entire embed element from scratch. <div id="gamediv"> <div id="countdown"><center title="adasfasfdf,100,100,hash">Loading... (show ads)</center></div> </div> Code (markup): (I used jQuery, and stopped it after 3 seconds because it was slow to test) function countdown(num) { if (num == 3) { // split it swfurl,height,width,something var gcode = $("#countdown center").attr("title").split(","); var embed = document.createElement('embed'); $(embed).attr({ "src" : gcode[0] + ".swf", "height" : gcode[1], "width" : gcode[2], "autostart" : "true" }); $("#countdown center").html(embed); return; } num++; setTimeout("countdown(" + num + ")", 1000); } Code (markup): For non-jquery, all I know is to set the attributes it's more like embed.setAttribute('src', 'file.swf'); etc... Hopefully it gets you on the right track. ^This way, it should (hopefully), not have sound playing because the game won't exist, although it will waste time by loading it after the 6 seconds is up.
I actually thought of that earlier but a lot of people will be putting the code on their MySpace profiles. MySpace disables all javascript so if I used javascript to print out the embed tag it would not show on MySpace. The way I have it now is that the game is set to play but if javascript is enabled/available then it will hide it behind my branding image. If javascript is disabled/unavailable than it will just show the game normally. I really need it to show on MySpace so I don't thing that will work out. Thanks for trying though.