2

I'm using Flash to generate animated content for my HTML. But the project is getting to long, and I am thinking about using several canvas files separated. I'm loading the canvas content (.js) in a <script> tag at the end of the HTML.

My issue is, how do I change that .js script once the first one is finished (I'm controlling navigation with a couple buttons). I know when to change the canvas file (when navigation in first file ends), but I don't know how to change it.
Should I try to change the content of the script tag? Should I load all the scripts and control them to establish and order to show them? Should I set visibility hidden to all canvas I don't want to see?

This is the code generated by flash into the HTML:

<script>
    var canvas, stage, exportRoot;

    function init() {
        canvas = document.getElementById("canvas");
        images = images||{};

        var loader = new createjs.LoadQueue(false);
        loader.addEventListener("fileload", handleFileLoad);
        loader.addEventListener("complete", handleComplete);
        loader.loadManifest(lib.properties.manifest);
    }

    function handleFileLoad(evt) {
        if (evt.item.type == "image") { images[evt.item.id] = evt.result; }
    }

    function handleComplete(evt) {
        exportRoot = new lib.cap_1();

        stage = new createjs.Stage(canvas);
        stage.addChild(exportRoot);
        stage.update();
        stage.enableMouseOver();

        createjs.Ticker.setFPS(lib.properties.fps);
        createjs.Ticker.addEventListener("tick", stage);
    }
    </script>

What I see, is that I can create some variables like exportRoot with all canvas values, and add/remove childs to convenience.

Any Idea of how to do this??

aRuiz
  • 21
  • 4

0 Answers0