# How to test for type

**URL:** <https://forum.kirupa.com/t/how-to-test-for-type/287243>\
**Category:** flash\
**Created:** [April 28, 2009, 3:52pm UTC](https://forum.kirupa.com/t/how-to-test-for-type/287243 "2009-04-28T15:52:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpha\_Remex](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@Alpha\_Remex](https://forum.kirupa.com/u/Alpha_Remex)\
**Post date:** [April 28, 2009, 3:52pm UTC](https://forum.kirupa.com/t/how-to-test-for-type/287243/1 "2009-04-28T15:52:13Z")

</div>

I have an array that holds several different components (e.g., radio buttons, comboboxes, etc).

I would like to loop through each component and add event listeners to those components that are radio buttons.

How do I test to see if the component in question is a radio button? Here’s what I have that, obviously, does not work:

```auto

private function addRadioListeners():void {

    //By the way, "Component" is a custom class that can represent any type of
    //component
    for each (var comp:Component in componentArray) {
        if(comp == RadioButton) {
            //Code to add listeners here
        }
    }
}

```
