Going crazy

Subscribe to Going crazy 3 posts

Sign in to reply


 
avatar for virror virror 267 posts
Flag Post

I can’t figure this out.
In my game i only had one enemy to test with, but now i added another one.
The problem is that when i click on it with my mouse and i have a EventListener(MouseEvent.CLICK, attack);
If i trace e.target, were e is e:MouseEvent i get [object slime_76] for one enemy, and [object MovieClip] for the other, the thing is that both enemies is from the same MovieClip “monsters” and are only different MovieClips in different frames.
Why are they not the same?
Does it make a difference if one MovieClip consists of other MovieClips and the others just taken from a MovieClip thats drawn directly?

 
avatar for Moonkey Moonkey 1007 posts
Flag Post

e.target will give you whatever child MovieClip you clicked on. e.currentTarget will work better, it gives you whatever dispatched the event.

 
avatar for virror virror 267 posts
Flag Post

Thanx, that was alot better, will remember that : )

Sign in to reply