# Access of possible undefined property text through a reference with static type class

**URL:** <https://forum.kirupa.com/t/access-of-possible-undefined-property-text-through-a-reference-with-static-type-class/318013>\
**Category:** flash\
**Created:** [January 8, 2011, 1:03am UTC](https://forum.kirupa.com/t/access-of-possible-undefined-property-text-through-a-reference-with-static-type-class/318013 "2011-01-08T01:03:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andiem\_design](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@andiem\_design](https://forum.kirupa.com/u/andiem_design)\
**Post date:** [January 8, 2011, 1:03am UTC](https://forum.kirupa.com/t/access-of-possible-undefined-property-text-through-a-reference-with-static-type-class/318013/1 "2011-01-08T01:03:06Z")

</div>

button.addEventListener(MouseEvent.CLICK, produce);

function produce(Event:MouseEvent):void  
{  
var t1:String=text1.text;  
var t2:String=text2.text;  
result.text = t1.text + “-” + t2.text;  
}

But the same error keeps showing up, related to the var t1 and var t2 lines:  
Access of possible undefined property text through a reference with static type class

What should I do? I already tried removing the String indication,  
trade : by =,  
including import flash.events.Event in the begining

but nothing seems to work… HELP

Thank you in advance,

Andrea
