Click to See Complete Forum and Search --> : Embeding flash file programatically


TonyLoco23
02-12-2009, 04:19 PM
I have a set of flash files who's name is stored in a table. I want to use vb script to determine which flash file to display on the page using the database recordset.

Here is my code:


<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','400','height','250','src','Images/<%=rst("FlshFile")%>','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','Images/<%=rst("FlshFile")%>' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="400" height="250">
<param name="movie" value="Images/<%=rst("FlshFile")%>" />
<param name="quality" value="high" />
<embed src="Images/<%=rst("FlshFile")%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="400" height="250"></embed>
</object></noscript>


FYI - 'rst' is the name of the recordset and 'FlshFile' is the name of the column in the table.

Right now all I get is a blank white space where the flash animation is supposed to be. The height and width of the flash animation are currently hard-coded but this is the correct height and width.

Is the problem to do with the fact that this is java script? So you cannot effectively use <% %> brackets to denote vb script wthin java script?

Though when I choose view source on the page, it has put the code correct.

Any ideas?

ryanbutler
02-12-2009, 04:36 PM
Are you passing query strings or how are the pages with the Flash content loading?

TonyLoco23
02-15-2009, 12:51 PM
Yes, an ID value is passed through a query string to determine the record to pull from the table that holds the names of the flash files.

ryanbutler
02-15-2009, 03:16 PM
Well, are you doing an conditional check and then if it passes, including the content? Like:

<%if Request.QueryString("Id") <> "" then %>

...load the flash file

<%else%>

..display an error message or default landing page
<%end if%>

Without more details, it's hard to troubleshoot the problem.

TonyLoco23
02-15-2009, 10:52 PM
Yes, thats right.

The problem is that the space where the flash file is supposed to appear comes out as a blank white space.

When I do view source on the asp page with the blank white space, the client side code appears to be identical to the code that is behind simply sticking the flash file on a webpage using the dreamweaver intereface (where the flash file appears fine.)

ryanbutler
02-16-2009, 08:28 AM
Are you calling the query string from a ASP file? If the ASP code isn't getting parse, it leads me to believe you're not working with an ASP file.

TonyLoco23
02-17-2009, 08:54 AM
Yes, the page is an asp file. Why dont I just post all the code for the entire asp page, its very short:


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Commercial Grant Info</title>
<link href="../styles/submenu2.css" rel="stylesheet" type="text/css" />
<link href="../../styles/submenu2.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>
<p>
<%

dim rst
dim lID
dim con
dim sConString
dim sDir

sDir = server.MapPath(".")

Set con = Server.CreateObject("ADODB.Connection")

' open the Access data source with the Connection object
sConString = "Provider=Microsoft.Jet.OLEDB.4.0; " _
& "Data Source=" & sdir & "\Grants.mdb"

con.Open sConString


lID = request.QueryString("PopID")

set rst = con.execute("select * from TbGrants where ID = " & lID)

response.write("<span class=""redtext"">" & rst("ProjName") & "</span><br>")

if not rst("FlshFile") = "" then
%>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','400','height','250','src','Images/<%=rst("FlshFile")%>','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','Images/<%=rst("FlshFile")%>' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="400" height="250">
<param name="movie" value="Images/<%=rst("FlshFile")%>" />
<param name="quality" value="high" />
<embed src="Images/<%=rst("FlshFile")%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="400" height="250"></embed>
</object></noscript>
</p>

<p>
<%
end if

if not rst("GrantAm") ="" then
%>
<span class="redtext">Grant Amount: <%=rst("GrantAm")%></span><br>
<%
end if

if not rst("FullAm") ="" then
%>

<span class="redtext">Total Project cost: <%=rst("FullAm")%></span><br>
<%end if%>
</p>

</body>
</html>

ryanbutler
02-17-2009, 10:10 AM
Is the path correct to the images folder?

TonyLoco23
02-17-2009, 10:17 AM
Yes, the flash files are in the images folder

ryanbutler
02-17-2009, 11:14 AM
How are you grabbing the query string though? You're requesting it, but do you push the ID in from another page? Also, have you tried checking a query string value that should work, that is, a record that exists in the database table?

TonyLoco23
02-17-2009, 02:53 PM
All of the values pulled from the database work fine except the flash file name. The problem is clearly nothing to do with the query string/request for the ID. That is all working fine.

The problem lies in the embedding of the flash file.

ryanbutler
02-17-2009, 03:00 PM
Sorry...I'm out of ideas. Never ran into this problem before.