# Loading dynamic text on rollovers & parsing the data

**URL:** <https://forum.kirupa.com/t/loading-dynamic-text-on-rollovers-parsing-the-data/257007>\
**Category:** Uncategorized\
**Created:** [April 9, 2008, 2:32pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-on-rollovers-parsing-the-data/257007 "2008-04-09T14:32:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![knightjd](https://avatars.discourse-cdn.com/v4/letter/k/e274bd/32.png) [@knightjd](https://forum.kirupa.com/u/knightjd)\
**Post date:** [April 9, 2008, 2:32pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-on-rollovers-parsing-the-data/257007/1 "2008-04-09T14:32:22Z")

</div>

Need Help,  
I’ve been trying to call in text dynamically on rollover.  
I just want to use one text document with multiple variables, and have multiple invisible buttons that access different variables in the text document as user rolls over. I did something similar to this in AS2. using LoadVarNum, but things are different in AS3.  
I was able to load my TXT doc, but i only want it to show when data is called.  
Get the btn’s rollover working, but I’m stuck on how to parse out the data for the rollover.

// instantiate the URLLoader class  
var loader:URLLoader = new URLLoader();

// Set the URLLoader’s dataFormat property to the static constant shown  
loader.dataFormat = URLLoaderDataFormat.VARIABLES;

// load the text file, making sure the path itself is an instance of URLRequest  
loader.load(new URLRequest(“sample.txt”));

//btn. & listener w’ rollover  
cp\_home\_txt.addEventListener(MouseEvent.ROLL\_OVER, over);  
cp\_home\_txt.addEventListener(MouseEvent.ROLL\_OUT, out);

//loading in parsed data text1  
loader.addEventListener(Event.COMPLETE, function(evt:Event):void {  
content\_txt.text = evt.target.data.text1;  
}

)  
//I put a trace here for now, but i don’t know what function should be in place to call data.  
function over(evt:MouseEvent):void {  
trace("over: " + evt.target.name);  
}

function over(evt:MouseEvent):void {  
trace("out: " + evt.target.name);  
}  
I want to eventually use an XML, but TXT docs are what I have now. Can someone out there please help?  
Thanks  
JD
