PDA

View Full Version : How do I get feedback from an ASP script?


OM2
11-18-2004, 02:07 PM
I have a simple form to mail script that is invoked when a button is pressed in my Flash movie.

I want to have the script report back to the Flash file and say whether it has executed properly or not.

Whatever I try, it doesn't seem to work!
I've tried using the sendAndLoad and other bits of code, but nothing seems to work. : (

Can anyone give me a sample scripts where you get feedback?

I know it must be only a few lines... but I just can't figure it out.

I need both the Flash code AND the ASP code (i'm not sure HOW to communicate back from the ASp to Flash).

Thanks.


OM

hangalot
11-18-2004, 04:01 PM
u use response.write to communicate back.

jrda
11-18-2004, 04:14 PM
you can loop in flash to check to see if a file on the server has changed. eg: say your asp page has finished doing whatever:

if you're not familiar with the fso object then use this sub to save text files to the server:

<%
private sub writeTextFile(strContent, strFilePath)
set fso = createObject("Scripting.FileSystemObject")
set f = fso.openTextFile(server.mapPath(strFilePath), 2, true)
f.write strContent
f.close
set f = nothing
set fso = nothing
end sub
%>
So do whatever you want to do with your asp and then save a file to the server
<%
for i = 0 to 100
response.write "this is the " & i & "th time I've done this..." & "<br />"
if i = 100 then
writeTextFile "done=true", "myfilePath.txt"
end if
next
%>

then on an onenterframe loop in flash keep checking whether the myFilePath.txt file has a variable called done that == true using loadVariables (google it if you don't know how: it's easy...)

That way your asp can report back.