dimanche 18 septembre 2016

Textfield assigned to Array element, then Textfield != Array element

I have an Array of strings:

private var phrase:Array = ["You will be given a series of questions like this:\n2 + 2 =\n(click or press ENTER to continue)","You can use the Keyboard or Mouse\nto deliver the answer\n\"ENTER\" locks it in.\n(click or press ENTER to continue)","\nClick Here\n to start."];  

I have a conditional later in the script to see if phrase[0] is current in instructText.text, but it isn't working, so I put a "test" directly after the assignment as below:

instructText.text = phrase[0];
if (instructText.text == phrase[0]) {
    trace("phrase zero");
}
else {
    trace("nottttttttt");
}  

//OUTPUT: nottttttttt

I've tried various combinations of "phrase[0]as String" and "String(phrase[0])" but haven't had any luck.

What am I missing?

Aucun commentaire:

Enregistrer un commentaire