Copy link to clipboard
Copied
Hi,
i've a symbol score in the library with a link ("Score").
I have the choice, for instanciate it, between :
var score1=new lib.Score();
then, i have the good graphics but i haven't any code associate to it.
var score1=new lib.Score();
then, i have all the functions and code associate to it but any graphics.
Is it possible to have a graphics link to a class, like with the as3 Class ? And if not, how to apporach of that ?
Thanks for your replies.
Copy link to clipboard
Copied
In fact, i try to extend the createJS MovieClip class in an extern class Score.
Copy link to clipboard
Copied
Hi.
I really didn't get what you want.
Do you mind providing a code example and/or an use case?
Regards,
JC
Copy link to clipboard
Copied
this works but it's really not nice :
class Score {
constructor(cible, x, y) {
var key = Object.keys(AdobeAn.compositions)[0];
var comp = AdobeAn.getComposition(key);
var lib = comp.getLibrary();
this.MC = new lib.Score();
this.MC.x = x;
this.MC.y = y;
cible.addChild(this.MC);
}
}
and i have to copy the 3 lines about AdobeAn in each class of this sort.
And that's composition instead of inheritance (i prefer the second for this type of class).
Maybe by transforming the library symbol into a component but i didn't find anything about that.
Thanks for your reply.
Copy link to clipboard
Copied
Hi.
Sorry for the delay.
So for me to understand: do you have a game and you want to add a score at runtime?
What exactly are you not being able to do?