Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populating dynamic textarea?

Status
Not open for further replies.

CGann

Programmer
Jan 23, 2004
31
0
0
US
Can anyone point out what I'm doing wrong here?
I'm trying to populate a dynamic textarea with values selected at random from an array. (It's going to be a simple flashcard app.)

Everything is working great except the population of the textarea. I'm including the code below. Also, I'm doing this in Flash MX.

TIA!

on (keyPress "1"){
var messageNum = 10;
/* Generate Random number to select array */
randomNumber = (Math.floor(Math.random()*10+1));
trace("randomNumber=" + randomNumber);
var fcards = [
{Q: "Q index 0, item 1", A: "A (index a0, item a1)", Ex: "Ex (index ex0, item ex1)"},
{Q: "Q index 1, item 2", A: "A (index a1, item a2)", Ex: "Ex (index ex1, item ex2)"},
{Q: "Q index 2, item 3", A: "A (index a2, item a3)", Ex: "Ex (index ex2, item ex3)"},
{Q: "Q index 3, item 4", A: "A (index a3, item a4)", Ex: "Ex (index ex3, item ex4)"},
{Q: "Q index 4, item 5", A: "A (index a4, item a5)", Ex: "Ex (index ex4, item ex5)"},
{Q: "Q index 5, item 6", A: "A (index a5, item a6)", Ex: "Ex (index ex5, item ex6)"},
{Q: "Q index 6, item 7", A: "A (index a6, item a7)", Ex: "Ex (index ex6, item ex7)"},
{Q: "Q index 7, item 8", A: "A (index a7, item a8)", Ex: "Ex (index ex7, item ex8)"},
{Q: "Q index 8, item 9", A: "A (index a8, item a9)", Ex: "Ex (index ex8, item ex9)"},
{Q: "Q index 9, item 10", A: "A (index a9, item a10)", Ex: "Ex (index ex9, item ex10)"}
];

/* len = fcards.length;
for(var i=0; i<len; i++){
trace(fcards.Q + newline + fcards.A + newline + " ex. " + fcards.Ex + newline);
} */
this.QTextArea.text = fcards[randomNumber].Q;
this.ATextArea.text = fcards[randomNumber].A;
trace("QTextArea = " + this.QTextArea.text + newline);
trace("fcards Q = " + this.fcards[randomNumber].Q + newline);
trace("fcards A = " + this.fcards[randomNumber].A + newline);
}
 
I've set the stage up with 4 layers:
questions - with a dynamic textarea (Multiline, var: QTextArea. instance name is blank)
answers - also with a dynamic text area (Multiline, var: ATextArea. instance name is blank)
button - which contains the code
bkgnd - just a background

But trace("QTextArea = " + this.QTextArea.text);
returns nothing. Any ideas?
 
GOT IT!!!
in my newbieness, I forgot to turn the button into a button from a "Movie Clip"

Thanks for the patience all!

cg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top