Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-29-2002, 09:13 PM   #1
Alice
Registered User
 
Join Date: May 2002
Posts: 4
Question looping through recordset pulled from asp

I'm pulling three db fields that, along with a little html, add up to a url to a quiz. I've set up an asp file that pulls the data and am able to yank it into the Flash with this coding:

onClipEvent(data)
{

strQuiz = "<a href='" + this["QuizType"] +"?QuizID=" + this["QuizID"] + "'>" + this["QuizName"] + "</a><br><br>";
}

onClipEvent(load)
{
CurrentRecord = 0;
loadVariables ("GetQuiz.asp?Record=0", this);
}

What I can't figure out is how to loop through the recordset to list all the records. I'm used to working in asp, and can't seem to get this through my thick skull. Any help from out there would be really appreciated.
Alice is offline   Reply With Quote
Old 05-29-2002, 10:41 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

do you want flash to loop thru a set number of records with multiple loadVariables() actions, just loading the variables you need for that specific record?

or do you want asp to loop through all the records and write a file with all of the variables (for all the records) you need?
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 05-29-2002, 11:00 PM   #3
Alice
Registered User
 
Join Date: May 2002
Posts: 4
Default

From the database table, my query in the asp file only pulls the three fields that I need to use for this. I want to take this data, in this case about 5 or 6 records with three fields each, and present a links list in Flash. Of the three records pulled, QuizType is the file name for the link (quiz.asp or quizWM.asp), QuizID is the quiz number, and QuizName is the name of the quiz. I'm adding in the html in the Flash action script to complete the url to the quiz. So, what I'm wanting to see is a list of links like this only they'd be links instead of printed out like this:

<a href="quiz.asp?QuizID=34">All About Cats</a>
<a href="quiz.asp?QuizID=55">More About Cats</a>

I can make this happen for one record, but I can't get the coding right for repeating. In an asp file, I'd probably use:

Do Until rsRecordSetName.EOF

But I'm blessed if I can figure it out in Flash. I've looked all over the place before casting myself on your collective mercies here!

Thanks for the reply and thanks for any help you might offer.
Alice is offline   Reply With Quote
Old 05-29-2002, 11:19 PM   #4
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

ya, flash doesn't know how often to do this unless you tell it how many records are in the recordset (via an asp call). then stick your loadVariables() action inside a for loop.

or probably easier for you and faster to process would be to have asp just run them all and output the entire string for you
want inside your do until eof loop.
response.write("&strQuiz"+ recordNbr +"="<a href='" + rs("QuizType")+"?QuizID=" + rs("QuizID"+ "'>" + rs("QuizName") + "</a>")


that way when the asp page is called by flash, flash will have a list of variables:
strQuiz0=...
strQuiz1=...
strQuiz2=...

and so forth, no need for any more calls to the server.

does that make since?
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 05-29-2002, 11:32 PM   #5
Alice
Registered User
 
Join Date: May 2002
Posts: 4
Default

Sounds to me like it'll work! I'll give it a try and post back here so others can see. Thanks much!
Alice is offline   Reply With Quote
Old 05-30-2002, 12:22 AM   #6
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

look forward to seein it.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 05-30-2002, 07:51 PM   #7
Alice
Registered User
 
Join Date: May 2002
Posts: 4
Smile

You're a genious, TG! What you gave me worked with a couple of minor tweeks. This is what actually does it:

<%
Do Until rsQuiz.EOF
recordNbr = recordNbr + 1
%>
<%
response.write("&strQuiz" & recordNbr & "=" & "<a href='" & rsQuiz("QuizType") & "?QuizID=" & rsQuiz("QuizID") & "'>" & rsQuiz("QuizName") & "</a>" & "<br><br>")
%>
<%
rsQuiz.MoveNext
loop
%>

This gives me output for three different screens in Flash, with three different difficulty levels of quizzes. Don't have it moved into the actual application with graphics yet, but it works just fine! Thanks again!
Alice is offline   Reply With Quote
Old 05-30-2002, 08:26 PM   #8
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

glad to hear it.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
flash TO asp TO authorize.net TO asp to FLASH ScotterMonk ActionScript 1.0 (and below) 17 05-30-2007 09:08 PM
ASP, recordset, Array mhughes ActionScript 2.0 4 01-13-2005 07:00 PM
Database simulated with arrays on a cd-rom lecasn5 Components 61 09-07-2004 11:40 AM
Flash & ASP (Paging Through Recordset) Chacal ActionScript 1.0 (and below) 4 07-31-2003 02:32 AM
Please help me with looping dynamic variables & looping ASP variables BigMac Server-Side Scripting 0 12-17-2002 05:55 AM


All times are GMT. The time now is 11:22 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.