?
Solved

Displaying data from ASP page

Posted on 2003-02-21
6
Medium Priority
?
197 Views
Last Modified: 2011-04-14
I have an asp page that queries a database and stores the data as variables. I am then passing those variables (name & email) to a flash file.

I have buttons that navigate through the records - however, when the flash file comes across a record from the database that has an empty field (ie. the name field has something in it, but the corresponding email field is blank) it displays the email field from the previous record, rather than leaving it blank.

Any ideas how to get round this?

thanks
0
Comment
Question by:arghh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:Rouneh
ID: 7992752
My guess is that flash is interpreting empty variables as follows: "No data in that variable? I'll just leave it alone then". This means you'll have to either send a blank space where the fields are empty, or reset the variables in your flash to "" before you run loadVariables().


Hope this helps.

Regards,
Rouneh.
0
 
LVL 6

Expert Comment

by:henryww
ID: 7992906
it depends on how u get ur variables from the asp file

if u are using loadVariables u will have the asp out as

'asp
while not rs.eof
   cnt = cnt + 1
   response.write ("name" & cnt & "=" & rs("name") )
   ... ... ..
   ... .. ..
wend

'the out is something like the following

name1=someone&email1=abc@domain.com&name2=another&email2=&name3=myName&email3=email@damin3.com ... etc

in ur flash, how do u eval the loaded variables?

i am only guessing ...
if u have something like the following...

//flash action script
..
rec_id = 2
..
inputEmail = eval("email" + rec_id);
if (inputEmail != null) {
  display_Email = inputEmail;
}
..
..

that way the last email is still in display_email ...
instead ...

if (inputEmail != null) {
  display_Email = inputEmail;
} else { //missing this else????
  // show empty
  display_Email = "";
}

hope this helps.

it will much easier to find out if u can post ur code in the asp & the flash


cheers
0
 

Accepted Solution

by:
jcori earned 316 total points
ID: 7993525
I'm doing a news/tour date admin for a band website.  When passing the fields out of flash, i load the text fields into the LoadVars Object and call a function:

_root.loadvarsobjectname.name = setEmpty(thisTextField);

function setEmpty(thisText){
   if(thisText == ""){
      thisText = "EMPTYDATA";
   }
    return(thisText);
}

function checkEmpty(thisText){
   if(thisText == "EMPTYDATA"){
       thisText = "";
   }
   return(thisText);
}

so if the text field that's being sent out is empty, it replaces it with EMPTYDATA and writes it to the MySQL database (in my case through PHP, but that makes no difference).  Then when the information is brought back into flash (either in the actual band website, or the admin app) I call the checkEmpty function to check for EMPTYDATA and replace it with "".  That might be easier than rewriting all your scripts if/when you change the format of your database.
0
 
LVL 5

Assisted Solution

by:elhy
elhy earned 312 total points
ID: 8023895
I've encounter this problem before and I tried checking for not null and empty string (""). But both way didn't work out for me (till now still don't know why). I've thought of icori's idea but I do not want to change the data in the database just in case something went wrong. These things can't be played around with in live data if you can what I mean.

So what's my solution? Here it is:


myEmail = email; //email is the variable passed to flash.
if (String(myEmail).length != 0) {
  emailField = myEmail;
}else{
  emailField = "";
}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question