Closed stevenalanstark closed 7 years ago
In the output from PixiAnimate you have a reference to the root stage class, e.g., lib.MyStageName. Normally this is created by default, but you can also create multiple instance of this class and add it to any Container.
Yes, in my case this code looks like, given a file named symbol_1.fla
:
lib.symbol_1 = MovieClip.extend(function () {
MovieClip.call(this, {
duration: 1,
framerate: 24
});
var instance1 = new lib.symbol___01___anim()
.setTransform(1, 1);
this.addChild(instance1);
});
If I were to copy that out, I could instantiate the clip, yes.
The issue is in the workflow, however. I am trying to be able to export from Animate CC, consume the output and instantiate multiple items, without needing a manual step to copy out code. To this end, I am looking for a factory, or a named class constructor. If I could, for example, say new lib.symbol_1();
, then I would be really happy because I know the filename and that will match the symbol_1 name, so this would work with my process. To this end I was looking to clone the MovieClip instance that was created.
OOps, ignore me.
It was a real constructor, just as you said. I had a bug in my code when trying to reference it, so that was on me. It works with new lib.symbol_1()
Cool!
Hello,
I am trying to create a workflow for adding multiple exported FLA files into one scene.
I have the items each loaded in, and in the callback from loadScene I can get access to the instance and change the position of the assets. This works great.
but when I try and load in the same scene more than once, I get errors about texture cache already having items cached with the same name, and performance is just horrendous.
It's clear to me that trying to load the same scene more than once is not a good approach.
I have moved on, and I am now trying to simply duplicate the root display object of the loaded scene, and instantiate 15 instances of the duplicate onto the stage.
Do you have any code examples for this?
thank you