So, I got flashcanvas pro from flashcanvas.net working!
You can view it on my server here:
linkit.faceyspacey.com
Ok here's what I did:
1) dropped the flashcanvas /bin folder with all their goodies in the document root
2) i added the js that turns it on when needed by adding this at the top of the <head>:
<!--[if lt IE 9]><script type="text/javascript" src="bin/flashcanvas.js"></script><![endif]-->
3) i created javascript indexOf() function for arrays and put it before the Construct 2 runtime js:
<script type="text/javascript">
if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; }
</script>
4) I loaded all the runtime js and index.html js generated by Construct 2 at the appropriate time (i just did it for now how the flashcanvas.net examples do it), which is like this:
<body onload="setup()">
5) then i created 2 setup() functions. one for IE 8 and below, and one for everything else. Here's how I toggle between the two:
<!--[if IE]><script type="text/javascript" src="setup-ie.js"></script><![endif]-->
<![if !IE]><script type="text/javascript" src="setup.js"></script><![endif]-->
6) so here's what setup-ie.js looks like. And I'll summarize what I did first. Basically it writes to the dom a different c2runtime.js file called c2runtime-ie.js. And in that js file all I did was change the addEventListener methods to attachEvent, which is supported in IE7 and IE8. And i did the same thing in setup-ie.js file, which contains the js Construct 2 puts in the index.html file. So here is setup-ie.js:
function setup() {
$('head').prepend("<script src='c2runtime-ie.js'>\x3C/script>");
jQuery(window).resize(function() {
if (window.c2resizestretchmode === 1)
{
window.c2resizestretchmode = 2; // put back when breaking back out of fullscreen
var canvas = document.getElementById("c2canvas");
window.c2oldcanvaswidth = canvas.width;
window.c2oldcanvasheight = canvas.height;
window.c2eventtime = Date.now();
var w = jQuery(window).width();
var h = jQuery(window).height();
cr_sizeCanvas(w, h);
}
else if (window.c2resizestretchmode === 2)
{
// Size event fires twice on FF + Chrome, ignore second trigger
if (Date.now() > window.c2eventtime + 50)
{
window.c2resizestretchmode = 0;
cr_sizeCanvas(window.c2oldcanvaswidth, window.c2oldcanvasheight);
}
}
});
// Start the Construct 2 project running on window load.
jQuery(document).ready(function ()
{
// Create new runtime using the c2canvas
cr.createRuntime("c2canvas");
});
// Pause and resume on page becoming visible/invisible
function onVisibilityChanged() {
if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden)
cr_setSuspended(true);
else
cr_setSuspended(false);
};
document.attachEvent("visibilitychange", onVisibilityChanged, false);
document.attachEvent("mozvisibilitychange", onVisibilityChanged, false);
document.attachEvent("webkitvisibilitychange", onVisibilityChanged, false);
document.attachEvent("msvisibilitychange", onVisibilityChanged, false);
}
------
So that leaves getting sound to work. I just started using Construct 2, with the sole aim being to get this to work in IE7 and IE8 using flash canvas. I looked through its Audio object real quick, and it seems completely custom, rather than based on SoundManager2, which seems to be the best cross-platform audio option.
C2 TEAM CAN WE REPLACE YOUR AUDIO FRAMEWORK WITH SOMETHING MORE CROSS PLATFORM AND MAKE IE7/IE8 SUPPORT ONE OF YOUR KEY SELLING POINTS? It seems to be a no brainer at this point. Maybe there are other bugs, depending on what you want to do with C2 that has made them stay away from IE7/IE8, but if their pretty fancy Space Blasters game works in IE7/IE8, many games your developers will want to make will work in those browsers.
What can we do to get sound working in IE7/IE8. What do you recommend?