PDA

View Full Version : How to pass data from asp to Flash


trekker880
06-05-2006, 09:12 AM
i need to pass data from asp to flash.i used two sepearte .swfs.one swf is sending a variable to the asp like this--
on(press){
var vijay:Number =1;
getURL("test.asp?button="+this.vijay,"_self","POST").

here is my test.asp
<%@ LANGUAGE="VBScript" %>
<!-- #INCLUDE file="include/DBcon.asp" -->
<!-- #INCLUDE file="include/adovbs.inc" -->
<%
dim varFlash
varFlash = trim(Request.QueryString("button"))
Dim objCon, objRS,my_sql
set objCon=Server.CreateObject("ADODB.Connection")
objCon.Open DBcon
Set objRS = Server.CreateObject("ADODB.Recordset")
my_sql="SELECT * from tblTest WHERE (ID = '" & varFlash &"')"
objRS.Open my_sql,objCon, adopenstatic, adlockpessimistic, adcmdtext

If objRS.EOF Then
Response.Write "NameLast=Not+Found&NameFirst=Not+Found&Position=Not+Found"
Else
Dim vijay(3), i, count
i = 0
count = 3

vijay(0)= objRS("FirstName")
vijay(1)= objRS("LastName")
vijay(2)= objRS("Position")

Do While i< count
Response.Write Server.URLEncode("vijay" & i & "=" & (vijay(i)) )& "&"

i=i+1
loop

End if
objRS.Close
Set objRS=Nothing
objCon.Close
Set objCon= Nothing
Response.End()
%>

Now how the other swf reterive these values from this test.asp and displayed it on the mypage.html. the two swf lies on this same page.
plz reply asap.
thanks

Cota
06-05-2006, 10:06 PM
One method is to sendAndLoad the variables from the first swf, via LoadVars. Now, connect the 2 swf's with localConnection, you can find the tutorial about this subject here:
http://www.actionscript.org/tutorials/intermediate/LocalConnections/index.shtml