# Button actions

**URL:** <https://forum.kirupa.com/t/button-actions/204354>\
**Category:** Uncategorized\
**Created:** [October 19, 2006, 3:35am UTC](https://forum.kirupa.com/t/button-actions/204354 "2006-10-19T03:35:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flash\_Man1](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Flash\_Man1](https://forum.kirupa.com/u/Flash_Man1)\
**Post date:** [October 19, 2006, 3:35am UTC](https://forum.kirupa.com/t/button-actions/204354/1 "2006-10-19T03:35:46Z")

</div>

why won’t this code work when its on my button but when its on my frame it works??  
is it something to do with the addlistener or something?? i’m detecting information from a radio button component.

here is the code:

```auto
var oListener:Object = new Object();
oListener.click = function(oEvent:Object):Void {
    trace(oEvent.target.selectedData);
    //q2_answer = oEvent.target.selectedData;
    if(oEvent.target.selectedData == "A snail"){
    q2_answer = "Q1 is correct"
} else {
    q2_answer = "Q1 is incorrect"
}
};
q1.addEventListener("click", oListener);

```
