CSS Version: basic caat-css.js example?

18 views
Skip to first unread message

Mark Rieck

unread,
Sep 20, 2013, 12:38:52 PM9/20/13
to caa...@googlegroups.com
I'm having trouble getting a basic example of caat-css working.

It sounds like all you should need to do is switch out caat.js for caat-css.js, use a div instead of a canvas, and setClear(false) on the director.

I tried doing that on multiple demos, and then simple examples but I always get the error:
  1. Uncaught TypeError: Cannot call method 'checkTimers' of undefined caat-css.js:23428

One of the simple examples I tried was the code from this issue...

<body>
            <div id="experiment-holder">
<div id="test_div">
</div>
            </div>
</body>
<script src="./caat-css.js"></script>
<script type="text/javascript">
var Scene;
var Director;

(function() {
  function scene() {
    Scene = Director.createScene();

    var bg = new CAAT.ActorContainer()
    .setBounds(0, 0, Director.width, Director.height)
    .setFillStyle('#333');

    Scene.addChild(bg);

    var img = new CAAT.Actor()
    .setBackgroundImage(Director.getImage('a_gun'));

    Scene.addChild(img);
  }

  function init() {
    Director = new CAAT.Director()
    .initialize(700, 300, document.getElementById('test_div'))
    .setClear(false);

    new CAAT.ImagePreloader().loadImages(
      [
        {id: 'a_gun', url: './agun_small.png'}
      ],
      function(counter, images) {
        console.log(counter, images);

        if (counter == images.length) {
          Director.setImagesCache(images);
          scene();
        }
      }
    );

    CAAT.loop(60);
  }

  init();
})();


I'm using the latest version of caat-css.js.  Does anyone know what I'm missing?

Thanks,
Mark



Reply all
Reply to author
Forward
0 new messages