Forums
This topic is locked
Displaying results from an Access DB in Flash
Posted 10 Jul 2005 15:05:27
1
has voted
10 Jul 2005 15:05:27 Rob Merrison posted:
Hi,I wondered if someone here could help me with a problem that i'm having trouble with.
I have a access database, and an asp script that produces the results from a query as variables that I pass into Flash to display.
It took some time to suss out and all appears to work fine.
One of the columns is a list of filenames, for a thumbnail image. What I need is to display the image thumbnail as opposed to the filename.
I have an asp/html based site that I put together for photographers www.imagerealm.co.uk/search_gen.asp . I am now going to try and create a Flash version of it. The site is currently dynamic where it gets all information from an access database.
below is the code.
the first is the list2.asp
Code:
<pre id=code><font face=courier size=2 id=code>
<%
IMSrc = "dib/gen_dib_data/images/"
THSrc = "dib/gen_dib_data/thumbs/"
IDI = "GE"
%> <%
Dim RecordView, Rst1, output1, collect1, SQL
Set RecordView = Server.CreateObject("ADODB.Recordset"

SQL="SELECT DISTINCT Photo.PDesc, Photographer.Fullname AS Expr1, Photo.PhotoID, Photo.[Date], Photo.[Size], Photo.Filename, Photographer.photogID, Photographer.GalleryLink FROM Photographer AS Photographer_1, (tCat INNER JOIN tSCat ON tCat.CatID = tSCat.CatID) INNER JOIN ((Photo INNER JOIN Photographer ON Photo.PhotogID = Photographer.photogID) INNER JOIN (tSSCat INNER JOIN SSC2Photo ON tSSCat.SSCatID = SSC2Photo.SSCatID) ON Photo.PhotoID = SSC2Photo.PhotoID) ON tSCat.SCatID = tSSCat.SCatID WHERE (((tCat.CatID)=37));"
Recordview.open SQL, "DSN=gen_dib_data"
Do While Not RecordView.EOF
Rst1=RecordView("PhotoID"

Rst2=RecordView("Pdesc"

Rst3=RecordView("Expr1"

Rst4=RecordView("Filename"

collect1 =collect1 & IDI&"-" & Rst1&","
collect2 =collect2 & Rst2&","
collect3 =collect3 & Rst3&","
collect4 =collect4 & THSrc & Rst4&","
RecordView.MoveNext
Loop
output1="&output1="& collect1 & "<br>"
Response.Write output1
Response.Write "&"
output2="output2="& collect2 & "<br>"
Response.Write output2
Response.Write "&"
output3="output3="& collect3 & "<br>"
Response.Write output3
Response.Write "&"
output4="output4="& collect4 & "<br>"
Response.Write output4
Response.Write "&"
Counter = 1
Response.Write "Counter=" & Counter
Response.Write "&"
RecordView.Close
Set RecordView = Nothing
%>
</font id=code></pre id=code>
These are the results I get ready for flash to read in:
Code:
<pre id=code><font face=courier size=2 id=code> &output1=GE-327,GE-331,GE-330,
&output2=Castle,Hadrians Wall,Large House,
&output3=Stuart Thomas,Stuart Thomas,Stuart Thomas,
&output4=dib/gen_dib_data/thumbs/st_0013.jpg,dib/gen_dib_data/thumbs/st_0017.jpg,dib/gen_dib_data/thumbs/st_0016.jpg,
&Counter=1&
</font id=code></pre id=code>
The following code is the actionscript that I use to display the results:
ActionScript:
<pre id=code><font face=courier size=2 id=code>
// depth
depth = -1;
// hide the origional clips
Rst1._visible = 0;
Rst2._visible = 0;
Rst3._visible = 0;
Rst4._visible = 0;
// split up the array by looking for the commas
Rst1_array = output1.split(","

Rst2_array = output2.split(","

Rst3_array = output3.split(","

Rst4_array = output4.split(","

// get the length of the array
Rst1_length = Rst1_array.length;
Rst2_length = Rst2_array.length;
Rst3_length = Rst3_array.length;
Rst4_length = Rst4_array.length;
// set the start y position (x position depends on where you put it on the screen)
yposition = 38;
// looping everything
for (i=0; i<Rst1_length; i++) {
// Rst1
duplicateMovieClip(Rst1, "Rst1" add i, depth);
setProperty("Rst1" add i, _y, yposition);
Rst1.Rst1 = Rst1_array[1];
set("Rst1" add i add ".info", Rst1_array[i]);
depth--;
// Rst2
duplicateMovieClip(Rst2, "Rst2" add i, depth);
setProperty("Rst2" add i, _y, yposition);
Rst2.Rst2 = Rst2_array[1];
set("Rst2" add i add ".info", Rst2_array[i]);
depth--;
// Rst3
duplicateMovieClip(Rst3, "Rst3" add i, depth);
setProperty("Rst3" add i, _y, yposition);
Rst3.Rst3 = Rst3_array[1];
set("Rst3" add i add ".info", Rst3_array[i]);
depth--;
// Rst4
duplicateMovieClip(Rst4, "Rst4" add i, depth);
setProperty("Rst4" add i, _y, yposition);
Rst4.Rst4 = Rst4_array[1];
set("Rst4" add i add ".info", Rst4_array[i]);
depth--;
// Set the y position plus 30
yposition = yposition+10;
}
</font id=code></pre id=code>
Rst4 is the column that displays the filenames and as previously mentioned I need this to be a 50px x 50px thumbnail instead.
My problem is that when I get the file details as a variable I need it to display the thumbnail image rather that the filename itself, do you know how this can be done?
The description field has some records with an “&” ie. Bride & Groom which flash will not display, why is this?
many thanks in advance for any help or guidance
Cheers Rob.