Skip to main content
chienbleu
Known Participant
February 4, 2023
Question

How do I scan for only ONE type of object? ActionScript 3.0

  • February 4, 2023
  • 1 reply
  • 248 views

I want to make an array of all the boxes on screen but it's also counting the mouse trails. This is the code I'm using which I don't understand in depth because I'm not an expirienced coder. How do I make it only count boxes, do I use an if statement?

 

stage.addEventListener(Event.ENTER_FRAME, eee);
function eee(event:Event)
{
function getCircles(container:DisplayObjectContainer):Array
{
for (var i:uint = 0; i < container.numChildren; i++)
if (container.getChildAt(i) is box)
{
var array:Array = new Array();
array.push(container.getChildAt(i));
}
return array;
}
blah.text = String(numChildren - 2)
}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 5, 2023

what's a box?

chienbleu
chienbleuAuthor
Known Participant
February 5, 2023

my movieclip

chienbleu
chienbleuAuthor
Known Participant
February 5, 2023

also ignore the "blah.text = String(numChildren - 2)"