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