PDA

View Full Version : ASP and Flash pass vars????


maccer
01-15-2002, 07:16 AM
I have a frameset [top and get]

top contains flash btns
get contains an ASP file that will be used a template

What i would like to do is

1. Click a flash btn in the 'top' frame
2. This target's the frame 'get' and pull out an ASP temp file
3. The geturl command in stage 1. also passed some vars which would inform the ASP file to embed a specfic swf into the page.

my ASP skills are really very poor..but i think i can understand the theory??!!!

maybe using a 'holder' .swf movie in the ASP file with its value/embed set as variables:

<param name=movie value="ASPvar">
<param name=quality value=high>
<embed src="ASPvar" quality=high

and then pass the correct vars (moviename.swf) into the ASP file from flash???

i would like to do something like this to :::

have the simplicity of one ASP template to contain all content etc...
and im having trouble preventing the swf files in the ASP from caching.....

this code does not work in preventing the swf file from caching

QUOTE]
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
[/QUOTE]


thats why i would like this method of adding a swf file to the asp template as that way i could add a '?math rnd' onto the get url call to give each swf a unique name...


+ a tried the (?math rnd) on the call of an ASP file with a flash movie in it and although the ASP file was fresh each time the swf was obviosly not as it still had the same file name....


hope this makes sense...

thanks in advance
m.

roele
01-15-2002, 07:22 AM
Try ....

Response.Expires = 60

tg
01-15-2002, 04:01 PM
look here (http://www.aspfaq.com/show.asp?id=2022) when i was doing alot of asp, i got alot of very good info from this site.

looks like they recomend using

response.expires=0


also, if you are using a variable in your code, should it look like this

<param name=movie value=<%=ASPvar%>>
<param name=quality value=high>
<embed src=<%=ASPvar%> quality=high

where ASPvar is the value passed to it from the flash buttons?... maybe i am missunderstanding what you are doing*shrug*.

maccer
01-15-2002, 08:39 PM
thanks tg + roele,

I am currently testing on a local ISS server and

Response.Expires = 60

does not work when it comes to getting rid of the cached flash...it acts like a HTML based pragma- nocache

the only way that has worked for me in the past it to add a random number onto the end of the file which ensures each session a fresh file is used...

and tg...


[PHP]
also, if you are using a variable in your code, should it look like this

<param name=movie value=<%=ASPvar%>>
<param name=quality value=high>
<embed src=<%=ASPvar%> quality=high

[/PHP


yes i would thinks so too i will try this method now while adding some random number on the end of the file name..

???
How would i add the random number using asp??? in flash i've created a function which goes like:


var rnd = Math.ceil(Math.random()*10000);
var randomThing = "?rnd=";

function myRandom () {
return (randomThing) add (rnd);
}



and then call my function like this:

on (release) {
_root.loadMovie("myMovie.swf" add (_root.myRandom()));

this all works great but how could i do this in ASP???

cheers
m.

maccer
01-15-2002, 08:46 PM
and tg

thanks for that link to www.ASPfaq.com
seems very quick/clean and effective cheers:)

maccer
01-15-2002, 10:54 PM
still no joy :(

in my 'top' frame i have the flash movie that calls the ASP file like so :

on (release) {
getURL ("myFile.asp?intName=myFile.swf", "get");
}

in the ASP file i have:


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="750" height="400">
<param name=movie =<%=intName%>>
<param name=quality value=high>
<embed src=<%=intName%>> quality=high width="750" height="400">
</embed>
</object>


for some reason the var pass is still not being resolved by the ASP page???

im guessing it could be something to do with the var inName being unable to contain the '.swf' part or something

tg
01-15-2002, 11:27 PM
that looks right, one thing i noticed (it may be a typo)...


<param name=movie =<%=intName%>>
<param name=quality value=high>
//should be:
<param name=movie value=<%=intName%>>
<param name=quality value=high>

tg
01-15-2002, 11:31 PM
try putting a Response.Write(intName) in your asp file, just to see the output and what it contains at that point, i don't see why it shouldn't say "myFile.swf"
good luck

maccer
01-16-2002, 01:37 AM
tried that and still????

i've probably another typo somewhere but i cant find it ...ahhhh :)

here is what i found on ASPfaq:



<%
strValue = "some string"
intValue = 5
Response.Write("<OBJECT clsid=[blah blah]>")
Response.Write("<PARAM NAME=INT VALUE=""<%=intName%>"">")
Response.Write("<PARAM NAME=INT VALUE=""<%=intName%>"">")
Response.Write("</OBJECT>")
%>


????but that script has errors in UltraDev as soon as i imported it???


here is a javascript version i found and modified but still does'nt work



<script language=JavaScript runat=server>

var strValue = "some string";
var intName = "personal.swf";
var intQuality = "high";
Response.Write("<OBJECT clsid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width ="750" height ="400">);
Response.Write("<PARAM NAME=movie VALUE=\"<%=intName%>\">");
Response.Write("<PARAM NAME=quality VALUE=\"<%=intQuality%>\">");
Response.Write("</OBJECT>");

</script>


but still no joy...:(

the quest continues :)

maccer
01-19-2002, 01:26 AM
somebody somewhere..... i know your out there...cmon reveal yourself :)

just want to keep this post fresh...

problem is left unsolved and i think this could be of benefit to many if we resovle it...
cheers
m.

roele
01-19-2002, 07:45 AM
Use

Response.Expires=0 !!!!

Otherwise take a look at my site
--> www.rolandschaer.ch

tg
01-21-2002, 09:20 PM
<%= "this string"%>
is the same as
response.write("this string")

so in your lines

Response.Write("<PARAM NAME=INT VALUE=""<%=intName%>"">")


is the same as saying

Response.Write("<PARAM NAME=INT VALUE=""Response.write(intName%>)"")

try changing it to

response.write("<PARAM NAME=INT VALUE="&intName&">")

do that for all the lines where you have <%=%> nested inside of response.write

good luck

maccer
01-23-2002, 10:29 PM
my head hurts :(

hey guys tg + roele

thanks for the help...but its still not cutting the mustard..

heres how the code to create a flash object looks now..



<%
intClassid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
intCodebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
intWidth = 750
intHeight = 400
intName = "mymovie.swf"
intPluginspage = "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
intQuality = "high"
intType = "application/x-shockwave-flash"
Response.Write("<OBJECT clsid=""<%=intClassid%>"" codebase=""<%=intCodebase%>"" width=""<%=intWidth%>""> height=""<%=intHeight%>"">")
Response.Write("<PARAM NAME=movie VALUE=""<%=intName%>"">")
Response.Write("<PARAM NAME=quality VALUE=""<%=intQuality%>"">")
Response.Write("<EMBED SRC=""<%=intName%>""> quality=""<%=intQuality%>"" pluginspage=""<%=intPluginspage%>"" type=""<%=intType%>"" width=""<%=intWidth%>"" height=""<%=intHeight%>"">")
Response.Write("</EMBED>")
Response.Write("</OBJECT>")
%>


is there anyway to fix this or have i completly miss understood your posts?

thanks
maccer

maccer
01-23-2002, 10:32 PM
it would be nice if i could use PHP on this server but typically not, as MING would soon slove this puzzle...

http://www.opaque.net/ming/

tg
01-23-2002, 11:10 PM
<%
intClassid = "clsid<img src="http://www.actionscripts.org/forums/images/icons/icon10.gif" border="0" alt="">27CDB6E-AE6D-11cf-96B8-444553540000"
intCodebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
intWidth = 750
intHeight = 400
intName = "mymovie.swf"
intPluginspage = "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
intQuality = "high"
intType = "application/x-shockwave-flash"
Response.Write("<OBJECT clsid="&<%=intClassid%>&" codebase="&<%=intCodebase%>&" width="&<%=intWidth%>&"> height="&<%=intHeight%>&">")
Response.Write("<PARAM NAME=movie VALUE="&<%=intName%>&">")
Response.Write("<PARAM NAME=quality VALUE="&<%=intQuality%>&">")
Response.Write("<EMBED SRC="&<%=intName%>&"> quality="&<%=intQuality%>&" pluginspage="&<%=intPluginspage%>&" type="&<%=intType%>&" width="&<%=intWidth%>&" height="&<%=intHeight%>&">")
Response.Write("</EMBED>")
Response.Write("</OBJECT>")
%>


notice all my variables are color code, all of yours are still red. your not concatinating your vars to the strings, your including them in the string. so its not working.

maccer
01-24-2002, 01:12 AM
concatinating...cool word..never cam across that b4 :)

tg, did you test that code? when i import that into my editor(ultradev) its full of errors...

im completly lost with this one...thread is becoming pretty hefty :)

if it helps i also posted this on flashkit aswell and was given this response..but i could'nt figure that out either??

What you've done is embed one set of asp script tags inside another!
You need to replace

-----------------------------------------------------------------------------
<%=intName%>
-----------------------------------------------------------------------------

with

-----------------------------------------------------------------------------
RESPONSE.WRITE int.Name
-----------------------------------------------------------------------------

Your trying to use the shortcut for response.write WHERE IT's used on it's own, within another asp code block. you can't do that. if you change all your entries using <%= XXXXX %> to what I've shown above then it should work.

Mark

tg
01-24-2002, 11:37 PM
and then i went and did it my self

so try this and see if it works any better...

<%
intClassid = "clsid<img src="http://www.actionscripts.org/forums/images/icons/icon10.gif" border="0" alt="">27CDB6E-AE6D-11cf-96B8-444553540000"
intCodebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
intWidth = 750
intHeight = 400
intName = "mymovie.swf"
intPluginspage = "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
intQuality = "high"
intType = "application/x-shockwave-flash"
Response.Write("<OBJECT clsid="&intClassid&" codebase="&intCodebase&" width="&intWidth&"> height="&intHeight&">")
Response.Write("<PARAM NAME=movie VALUE="&intName&">")
Response.Write("<PARAM NAME=quality VALUE="&intQuality&">")
Response.Write("<EMBED SRC="&intName&"> quality="&intQuality&" pluginspage="&intPluginspage&" type="&intType&" width="&intWidth&" height="&intHeight&">")
Response.Write("</EMBED>")
Response.Write("</OBJECT>")
%>

maccer
01-25-2002, 01:08 AM
oooooo.....tg..so close it hurts!!

sort of works but it writes out alot of the code and also the movie is very small not 750x400...

heres the page i have:


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<%
intClassid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
intCodebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
intWidth = "750"
intHeight = "400"
intName = "personal.swf"
intPluginspage = "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
intQuality = "high"
intType = "application/x-shockwave-flash"
Response.Write("<OBJECT clsid="&intClassid&" codebase="&intCodebase&" width="&intWidth&"> height="&intHeight&">")
Response.Write("<PARAM NAME=movie VALUE="&intName&">")
Response.Write("<PARAM NAME=quality VALUE="&intQuality&">")
Response.Write("<EMBED SRC="&intName&"> quality="&intQuality&" pluginspage="&intPluginspage&" type="&intType&" width="&intWidth&" height="&intHeight&">")
Response.Write("</EMBED>")
Response.Write("</OBJECT>")
%>
</body>
</html>


im gonna have a tinker with the code im sure it must be something simple...thanks tg..nearly there :) :) :)