Copy link to clipboard
Copied
I have to instances of the same movieclip with the same instance name but it only works for one. I don't want that. I've looked up many ways to do this but I'm a sort of begginer coder so I don't really get what it means or how to implement it into my code. I don't get how "for loops" and stuff work but I know it involves looping through all the instances but I just don't get it. Please explain a simple way to do this and why. Here's the code:
"
star.gotoAndStop("off")
stage.addEventListener(Event.ENTER_FRAME,loop)
function loop(event:Event)
{
star.x = mouseX
star.y = mouseY
if (rectangle.hitTestObject(star))
{
star.gotoAndStop("on")
}
else
{
star.gotoAndStop("off")
}
}
"
Copy link to clipboard
Copied
don't use the same instance name, ever.
Copy link to clipboard
Copied
but what if i want to have a hundred of the same movieclip. i don't wanna have to name all of them individually
Copy link to clipboard
Copied
then name them using as3 or use parent.getChildAt()
Find more inspiration, events, and resources on the new Adobe Community
Explore Now