# Referring a variable in AS3 class file not inside the main timeline

**URL:** <https://forum.kirupa.com/t/referring-a-variable-in-as3-class-file-not-inside-the-main-timeline/330501>\
**Category:** Uncategorized\
**Created:** [January 30, 2013, 12:55pm UTC](https://forum.kirupa.com/t/referring-a-variable-in-as3-class-file-not-inside-the-main-timeline/330501 "2013-01-30T12:55:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrwizard](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@mrwizard](https://forum.kirupa.com/u/mrwizard)\
**Post date:** [January 30, 2013, 12:55pm UTC](https://forum.kirupa.com/t/referring-a-variable-in-as3-class-file-not-inside-the-main-timeline/330501/1 "2013-01-30T12:55:08Z")

</div>

Hi I have button (instance name-test1) on main time line. and following as on class file (main.as) works fine.

> if(String(\_xml.setup.buttons.music.@state) == “enabled”){  
> test1.buttonMode = true;  
> test1.mouseEnabled = true;  
> test1.addEventListener(MouseEvent.CLICK, myBtnClicked);

function myBtnClicked(e:MouseEvent):void {  
var url:String = “[http://www.example.com/](http://www.example.com/)”;  
var request:URLRequest = new URLRequest(url);  
try {  
navigateToURL(request, ‘\_blank’);  
} catch (e:Error) {  
trace(“Error occurred!”);  
}  
}

Now for some reason I need to place the symbol inside another symbol2 (symbol2 is on maintimeline) but code is not working anymore and getting error

1120: Access of undefined property test1.

Thanks…needs to fix that
