• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Participant ,
Feb 04, 2023 Feb 04, 2023

Copy link to clipboard

Copied

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)
}

TOPICS
ActionScript , Code

Views

128

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 04, 2023 Feb 04, 2023

Copy link to clipboard

Copied

what's a box?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 04, 2023 Feb 04, 2023

Copy link to clipboard

Copied

my movieclip

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 04, 2023 Feb 04, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2023 Feb 05, 2023

Copy link to clipboard

Copied

LATEST

is "box" is the instance name of a movieclip or the class name?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines