Reputation: 638
I can run the code below, where the answers are dynamic text boxes hovering over the buttons. However, the user can't click the button where the textbox overlaps it. I need a way to either assign button labels like the 4 text boxes below or make it so the textboxes do not interfere with clicking the button? Any suggestions would be appreciated, thanks!
var myXML:XML = new XML();
var XML_URL:String = "http://localhost/connect.php";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void
{
var finalXML:XML = XML(myLoader.data);
trace(finalXML);
trace("Data loaded.");
trace(finalXML.triviaQuestion[0].answer1[0]);
questionBox.text = finalXML.triviaQuestion[0].question[0];
answerText1.text = finalXML.triviaQuestion[0].answer1[0];
answerText2.text = finalXML.triviaQuestion[0].answer2[0];
answerText3.text = finalXML.triviaQuestion[0].answer3[0];
answerText4.text = finalXML.triviaQuestion[0].answer4[0];
}
Update: I found the following to change the label, however I am confused as how I do this to buttons I have already created, perhaps using the instance name?
var myButton:Button = new Button();
myButton.label = "Click me";
Upvotes: 1
Views: 6209
Reputation: 1
Yes, that's the way. It's how I do it. But however, how can I now make that more flexible, by when I use Locale to change languages - how do I put the contents of a key from the array into the label?
btnGPS.label = Locale.loadString("IDS_001");
for example
Upvotes: 0
Reputation: 638
Ok, for anyone who runs into the same problem...If you have a button instance with the name "answerBut1", then you can do the following:
var myButton:Button = new Button();
myButton = answerBut1;
myButton.label = "Click me";
Upvotes: 2