undefined variable enigma

  • RabbitKing
  • Newbie
  • Newbie
  • RabbitKing
  • Posts: 9
  • Loc: Camp Victory, Iraq

Post 3+ Months Ago

Hi,
I'm developing the biggest headache over the smallest problem I could possibly immagine.

Here's the background:
I'm building a flash based front end for a SQL database using ASP as the mediator (I'm planning to switch to PHP as soon as my System Admin guys shell out some cash).

my x-www-url-encoded return resembles count=3&fName=Joan&mName=Mary&lName=Smith&fName1=Joan&mName1=Mary&lName1=Smith&fName2=Hector&mName2=Mansuela&lName2=Gonzales&fName3=Greg&mName=Bartholemeu&lName3=Johnson&loaded=True

The ASP portion of my query is working great, and then I loadvariables ("url", "_root.dataStore"); no problem.

I have 3 dynamic text fields named f, m, and lNameDisplay, a next, and a previous record button.

i have a onclipevent (data) { } line where i have it spit out my SQL query into the respective text boxes.

Here's the odd thing that I can't figure out... I have a _global variable declared called CurrentRecord, and on the button events it calls a CurrentRecord++ or -- respectively, but I always get an undefined variable when I try to combine two variables to flop through my records.

eg.
Code: [ Select ]
_global.currentRecord = 1

trace(fName); // output is Joan
trace(fName1); // output is Joan
trace(fName2); // output is Hector

trace(fName+currentRecord); // output is Undefined
trace("fName"+currentRecord); // output is Undefined

fNameVar = eval("fName"+currentRecord)
trace(fNameVar); // output is Undefined.

trace(fName[currentRecord]); // output is Undefined
trace("fName"[currentRecord]); // output is Undefined
  1. _global.currentRecord = 1
  2. trace(fName); // output is Joan
  3. trace(fName1); // output is Joan
  4. trace(fName2); // output is Hector
  5. trace(fName+currentRecord); // output is Undefined
  6. trace("fName"+currentRecord); // output is Undefined
  7. fNameVar = eval("fName"+currentRecord)
  8. trace(fNameVar); // output is Undefined.
  9. trace(fName[currentRecord]); // output is Undefined
  10. trace("fName"[currentRecord]); // output is Undefined


If anyone can help, please pretty please do. I'm pulling my hair out because of this silly problem.

-RK
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

Code: [ Select ]
trace(this["fName"+currentRecord]);
:D
  • RabbitKing
  • Newbie
  • Newbie
  • RabbitKing
  • Posts: 9
  • Loc: Camp Victory, Iraq

Post 3+ Months Ago

Joebert,
... I love you.

-RK

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.