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!!