0 Favourites

Flashcanvas an answer for non-html5 browsers?

  • flashcanvas.net/example/benchmark

    Would it, in theory, be possible to use this as opposed to the canvas, and perhaps remove sound support to allow non-html5 compliant browsers the ability to use games?

  • It's easy to do it now.

    You just have to edit the index.html file ;).

  • ... Would it, in theory, be possible to use this as opposed to the canvas ... ?ot just in theory, but in practice! Simply download flashcanvas.js and flashcanvas.swf, and then add to your index.html:

    <!--[if lt IE 9]>
    <script type="text/javascript"
            src="<your dir>/flashcanvas.js">
    </script>
    <![endif]-->
    

    No other change needed!

  • Are you telling me that we no longer require html5 enabled browser?

  • So it would seem! (At least as far as < IE9 are concerned.)

    There's a good account of how it works here.

  • This looks interesting - will check it out and see if it works. Can't make any guarantees though, excanvas was another alternative for example but turned out to be far too slow to be useful.

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

  • I don't see why support in IE7/IE8 is so important.

  • sqiddster : for those using C2 to create webapps, and not only games, IE7 support can be useful (since a lot of companies still use it).

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • So, does this mean we'll be able to submit to Newgrounds? (NG will most likely eventually accept HTML5, but there seems to be some resistance to it right now, so I don't see it happening in the near future.)

  • faceyspacey: nothing can get more cross-platform when it comes to audio. Different browsers have different implementations of audio, even though HTML5 attempts to standardize it.

  • what do you mean? how do you suggest we get sound to work in ie7 and 8?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)