# Update text when object is clicked

**URL:** <https://forum.kirupa.com/t/update-text-when-object-is-clicked/328349>\
**Category:** Uncategorized\
**Created:** [May 10, 2012, 1:34am UTC](https://forum.kirupa.com/t/update-text-when-object-is-clicked/328349 "2012-05-10T01:34:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt7](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@Matt7](https://forum.kirupa.com/u/Matt7)\
**Post date:** [May 10, 2012, 1:34am UTC](https://forum.kirupa.com/t/update-text-when-object-is-clicked/328349/1 "2012-05-10T01:34:03Z")

</div>

Hi,

I am using a main class with a search field, ‘Search’ is a MovieClip:

```auto
public var searchField: Search

```

In another class i want to be able to say that when objects are clicked - update the search text with the variable name…

```auto
function onPlaneClick(evt:InteractiveScene3DEvent):void 

            replaceSearchText(name);
            
        }
    

function replaceSearchText(name : String) : void { //Replace text function here 
            searchField.search_txt.text = name;
            trace("The artist to replace the search is:" + name);
        }

```

the error i am getting is 1120: access of undefined property searchField… even though searchField is a public var in Main.as

How can i replace the text when the plane is clicked ?
