A little context: I've created a detailed MovieClip with timeline animation in Flash Pro / Adobe Animate and exported to a CreateJS / EaselJS library. When I instantiate it at runtime it takes longer than a frame or 'tick' to complete this instantiation, and the animation playback waits before advancing to the next frame. This is causing a hiccup in a playing animation. This is a problem that's coming up a lot in my project. How can I overcome this hiccup without simplifying the frame art in the MovieClip?
Code: In case it's not clear, this is what I'm talking about...
var instanceMC = new lib.bigMovieClip_mc(); // <-- LONG DELAY, OVER 1 TICK IN TIME
stage.addChild(instanceMC); // <-- from here on it seems to run smoothly
instanceMC.x = xPosition;
instanceMC.y = yPosition;
stage.update();
My ideas:
- If asynchronous instantiation is an option, that would work nicely for my situation, but I couldn't figure out if and how this can be done. I see it can be done for SpriteSheetBuilder, which is a similar but different situation (I can't use SpriteSheetBuilder because I have nested MovieClips that are independently controlled).
- I can break up the MovieClip into smaller MovieClips and instantiate them independently, then assemble them together. This is somewhat annoying, but doable. If I did that, I would want to listen for an event for the completion of each instantiation. Does such an event exist? I couldn't find one in the docs.
- LoadJS. I'm pretty unfamiliar with LoadJS. I checked it out a bit, and it looks like it's for managing downloading, not other initialization tasks. However, if it could add a series of large instantiations to the load queue (or if there is something similar), and have it not hold up timeline playback during instantiation, that would work well.
- Multiple canvases and stages? If I add a second canvas with its own stage, I suppose that each stage would have independent frame tickers and therefore, by instantiating my MovieClip in one and playing my animation in the other, I could decouple the instantiation and playback. In my particular case, each part of the application is pretty independent, so switching canvas mid usage is somewhat doable. I'd rather not deal with juggling an application split in two, but it also seems like a straightforward way to address the issue without digging deep into functionality. Is this even technically possible, or did I make a bad assumption?
HELP: What approach can you suggest (either listed or not) that would solve my issue?