I’ve an animation based html project built on Flash CC and struggling about preloading separately.
What I am trying to do is;
- Load 1 image (says “please wait”) and createjs export.
- Animation stops at the begining of timeline, call a function here.
- load some assets.
- start animation
- stop animation at a certain point on timeline. Then load assests of next part of animation.
- When loading complete, continue on animation. etc.
I’m ok with loading all assets and playing the whole animation. But when it comes to separate the manifests; it loads the files I wanted and continues to the animation, but loaded images are not displaying on canvas.
I’m using the below code as init.js file in html;
var canvas, stage, exportRoot;
function init() {
canvas = document.getElementById("canvas");
images = images||{};
preloadLaunch();
}
function preloadLaunch(){
var loader = new createjs.LoadQueue(false);
loader.addEventListener("fileload", handleFileLoad);
loader.addEventListener("complete", handleComplete);
loader.loadManifest(lib.properties.manifestLaunch); //selects the manifest from createjs export, first image says please wait.
}
function handleFileLoad(evt) {
if (evt.item.type == "image") { images[evt.item.id] = evt.result; }
}
function handleComplete() {
exportRoot = new lib.project();
stage = new createjs.Stage(canvas);
stage.addChild(exportRoot);
stage.update();
stage.enableMouseOver();
createjs.Ticker.setFPS(lib.properties.fps);
createjs.Ticker.addEventListener("tick", stage);
}
/// triggers from animation timeline
function preloadPart01() {
var loader01 = new createjs.LoadQueue(false);
loader01.addEventListener("fileload", handleFileLoad);
loader01.addEventListener("complete", start);
loader01.loadManifest(lib.properties.manifestPart01); //selects the manifest from createjs export
}
function start() {
stage.update();
exportRoot.animation.gotoAndPlay("START"); // files are loaded in manifestPart01 and starts the animation, but loaded images are not visible.
}
I was thinking that was about "getResult" but I couldn't implement it to the code. I'll be glad for any help.
Thank you very much.