Arfian90
Arfian90

Reputation: 71

CreateJs MovieClip Instance name

Hi Guys (sorry for my bad english),

I've stuck with this in a week, is it possible to get the movieclip instance name with createJS (I've put the movieclip manually on the stage and I give it an instance name), in AS3 I can use movieclip.name to get the instance name, how can I do that in createJS, when I use this.movieclipName.name it always return null in console log, do You have any suggestion? Thanks for Your help?

Upvotes: 1

Views: 2782

Answers (2)

i solve this problem using:

for (i = 1; i < 6; i++) {
this["m" + i].addEventListener("click", clickme.bind(this));
this["m" + i].hamdy=i;}

so you can use var hamdy to pass any change in clickme funaction.

Upvotes: 0

Arfian90
Arfian90

Reputation: 71

@Ferry thank You very much for Your solution. finally I figured it out, We can't get the instance name of the object by myObject.name because the name of the object is not signed previously (it looks like the instance name not same as name in html5). that's why it always giving a null. This is my script to get all the instances name of my objects.

for (var a = 0; a <= maxObject - 1; a++) {
   var myObjectName = 'object' + (a + 1);
   var myObject = this[arrObject[a]];

   myObject.name = myObjectName;
}

Thank you guys for all of your respon.

Upvotes: 0

Related Questions