# Displaying text from a rollOver

**URL:** <https://forum.kirupa.com/t/displaying-text-from-a-rollover/295668>\
**Category:** Uncategorized\
**Created:** [September 2, 2009, 7:01pm UTC](https://forum.kirupa.com/t/displaying-text-from-a-rollover/295668 "2009-09-02T19:01:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icekomo](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@icekomo](https://forum.kirupa.com/u/icekomo)\
**Post date:** [September 2, 2009, 7:01pm UTC](https://forum.kirupa.com/t/displaying-text-from-a-rollover/295668/1 "2009-09-02T19:01:30Z")

</div>

Ok I have a bunch of buttons that represent a different restaurant. When I roll over the button I am the name of the restaurant to appear in a dynamic text field. Now I can get this to work, but I feel that I am doing this the long way and that there should be a more efficient way of doing it. Is there a way of setting up an var object that would contain the names and when the button is rolled over , it would pull that name from that object and place it into the text field?  
Here a sample of the code that I am using:

function offName(event:MouseEvent):void  
{  
MovieClip(root).names\_mc.gotoAndStop(1);  
}  
//restaurant 1  
function restName1(event:MouseEvent):void  
{  
MovieClip(root).names\_mc.gotoAndStop(“alma”);  
}

nameBtn.addEventListener(MouseEvent.MOUSE\_OVER, restName1);

this.addEventListener(MouseEvent.MOUSE\_OUT, offName);

Thanks for your help
