2 Flash canvas animations on the same HTML page

1

I need to put 2 Flash animations on one page, only 1 animation appears, the other one goes blank.

I tried 2 "inits" but it did not work. When I was exporting, I libs with different names to avoid conflicts.

Has anyone ever had anything like this?

<script src="http://code.createjs.com/easeljs-0.8.1.min.js"></script><scriptsrc="http://code.createjs.com/tweenjs-0.6.1.min.js"></script>
<script src="http://code.createjs.com/movieclip-0.8.1.min.js"></script><scriptsrc="http://code.createjs.com/preloadjs-0.6.1.min.js"></script>
<script src="unitec58.js"></script>
<script src="skala20168.js"></script>
<script>

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

    var loader = new createjs.LoadQueue(false);
    loader.addEventListener("fileload", handleFileLoad);
    loader.addEventListener("complete", handleComplete);
    loader.loadFile({src:"media/extra/unitec58_atlas_.json", type:"spritesheet", id:"unitec58_atlas_"}, true);
    loader.loadManifest(lib2.properties.manifest);
}

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

function handleComplete(evt) {
    var queue = evt.target;
    ss["unitec58_atlas_"] = queue.getResult("unitec58_atlas_");
    exportRoot = new lib2.unitec58();

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

    createjs.Ticker.setFPS(lib2.properties.fps);
    createjs.Ticker.addEventListener("tick", stage);
}

function init2() {
    canvas = document.getElementById("canvas2");
    images1 = images1||{};
    ss = ss||{};

    var loader = new createjs.LoadQueue(false);
    loader.addEventListener("fileload", handleFileLoad2);
    loader.addEventListener("complete", handleComplete2);
loader.loadFile({src:"media/extra/skala20168_atlas_.json", type:"spritesheet", id:"skala20168_atlas_"}, true);
    loader.loadManifest(lib1.properties.manifest);
}

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

function handleComplete2(evt) {
    var queue = evt.target;
    ss["skala20168_atlas_"] = queue.getResult("skala20168_atlas_");
    exportRoot = new lib1.skala20168();

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

    createjs.Ticker.setFPS(lib1.properties.fps);
    createjs.Ticker.addEventListener("tick", stage);
}

</script>
</head>

<body onload="init(); init2();" style="background-color:#D4D4D4">

<canvas id="canvas" width="300" height="250" style="background-color:#FFFFFF">
</canvas>

<canvas id="canvas2" width="300" height="250" style="background-color:#FFFFFF">
</canvas>
    
asked by anonymous 02.02.2016 / 20:23

0 answers