Copy link to clipboard
Copied
Hi there,
I want to use evt.currentTarget but I can't quite get my head around it.
I have 5 movie clips. Each with a 'clicked' label inside of them which show the users once the user have clicked.
I could easily create 5 movie clips with 5 different instance names - but I want to do it a little better using evt.currentTarget.
Currently all 5 movie clips are called 'noBtn'.
Here's my code - Currently this code only works for the last 'noBtn' (it only works for one of them) - but it should work for all 5 (or so I thought).
this.noBtn.addEventListener('click', fl_MouseClickHandlerNo.bind(this));
function fl_mouseClickHandlerNo(evt){
var item = evt.currentTarget;
item.gotoAndStop('clicked');
}
If anyone could give me a little explanation as to why it doesn't work that would be great.
eugener2418576 wrote
Currently all 5 movie clips are called 'noBtn'.
No. Just... no. You can't refer to multiple symbols by the same name. The IDE allows the illusion of giving the same name to multiple symbols, but once published, only one of them will actually have that name. The rest will receive automatically generated names like "instance_1", "instance_2", etc...
Copy link to clipboard
Copied
eugener2418576 wrote
Currently all 5 movie clips are called 'noBtn'.
No. Just... no. You can't refer to multiple symbols by the same name. The IDE allows the illusion of giving the same name to multiple symbols, but once published, only one of them will actually have that name. The rest will receive automatically generated names like "instance_1", "instance_2", etc...
Copy link to clipboard
Copied
Thank you, that's what I needed to hear!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now