# Problem populating a button with XML

**URL:** <https://forum.kirupa.com/t/problem-populating-a-button-with-xml/291296>\
**Category:** flash\
**Created:** [June 27, 2009, 2:58pm UTC](https://forum.kirupa.com/t/problem-populating-a-button-with-xml/291296 "2009-06-27T14:58:05Z")\
**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:** [June 27, 2009, 2:58pm UTC](https://forum.kirupa.com/t/problem-populating-a-button-with-xml/291296/1 "2009-06-27T14:58:05Z")

</div>

Hey Everyone,  
I am having a problem with populating a button with XML and having that xml say for the roll over effect. I got the XML to show up inside the \_mc that I am using as a button.

Here is the code I am using to call the XML in:  
//Load in XML  
var data\_xml:XML;  
var xmlReq:URLRequest = new URLRequest(“xml/grassRoots.xml”);  
var xmlLoader:URLLoader = new URLLoader();  
XML.ignoreWhitespace = true;  
//menu.homeBtn.home\_txt.condenseWhite = true;

function xmlLoaded(event:Event):void  
{  
data\_xml = new XML(xmlLoader.data);  
menu.homeBtn.home\_txt.htmlText = data\_xml.menu.button1.title;  
menu.homeBtn.homeBold\_txt.htmlText = data\_xml.menu.button1.title;  
trace(data\_xml);   
}

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);  
xmlLoader.load(xmlReq);

Here is my code for the roll over effect that I created a package for:  
package  
{  
import flash.display.MovieClip;  
import flash.events.Event;  
import flash.events.MouseEvent;  
//import fl.controls.Button;

```
public class btnEffect extends MovieClip
{		
	public function btnEffect()
	{
		this.buttonMode = true;
		this.mouseChildren = false;
		this.addEventListener(MouseEvent.MOUSE_OVER, rollOn);
		this.addEventListener(MouseEvent.MOUSE_OUT, rollOff);
	}
	
	
	public function rollOn(event:MouseEvent):void
	{
		play();
	}
	
	public function rollOff(event:MouseEvent):void
    {
    	this.addEventListener(Event.ENTER_FRAME,revFrame);
    }
   
  	public function revFrame(event:Event):void
  	{
  		prevFrame();
		if(currentFrame == 1) 
		{
    		//trace("I'm done!!!");
			this.removeEventListener(Event.ENTER_FRAME, revFrame);
    	}
  	}
}

```

}

Everything works until I roll over the button, then once the playhead hits another keyframe for the text it goes blank. I just need it to populate the button at all times. Does this make sense as to what problem I am having?  
I think it’s how I am calling in the xml, but I’m not all that experienced with as 3.  
Thanks for your help in advance!!
