Solved

Sending vars from a classic ASP page to Flash using AS3?

Posted on 2011-02-23
4
583 Views
Last Modified: 2012-05-11
Hi All,

I am having a bit of trouble retrieving variables from an ASP page. It returns the entire page whereas I just need the variable strAnswer from the page. Any suggestions? Please help.

Here is my code:

var loader:URLLoader = new URLLoader();
        loader.addEventListener(Event.COMPLETE, onDataSaved);
        loader.dataFormat = URLLoaderDataFormat.VARIABLES;

        var request:URLRequest = new URLRequest("http://" + host + urlPath + "setXML.asp");
        request.method = URLRequestMethod.POST;

        var variables:URLVariables = new URLVariables();
        variables.xmlString = str;
        variables.eltGuid = eltGuid;
        request.data = variables;

        loader.load(request);


    private function onDataSaved(e:Event):void 
    {
        var loader2:URLLoader = URLLoader(e.target);
        loader2.dataFormat = URLLoaderDataFormat.VARIABLES;
        trace(loader2.data.strAnswer);

    }

Open in new window

0
Comment
Question by:toneDigital
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:scooby_56
ID: 34964924
What does the response page look like ? full XML ?

post an example
0
 

Author Comment

by:toneDigital
ID: 34965101
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% 

Response.CacheControl = "no-cache" 
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<!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=utf-8" />
<title>setASP</title>
</head>

<body>
<%

Dim xmlBlock, strEltGuid, objRQL
xmlBlock = escape(Request.Form("xmlString"))
strEltGuid = Request.Form("eltGuid")

'---------------------------
'Post to RedDot CMS via RQL
'---------------------------

Set objRQL = Server.CreateObject("RDCMSASP.RdPageData")
objRQL.XMLServerClassname = "RDCMSServer.XmlServer"
xmlData = "<IODATA loginguid=" & Chr(34) & Session("LoginGuid") & Chr(34) &  " format=" & Chr(34) & "1" & Chr(34) & " sessionkey=" & Chr(34) & Session("SessionKey") & Chr(34) & "><ELT translationmode='0' extendedinfo='' reddotcacheguid='' action='save' guid='" & strEltGuid & "' pageid='' id='' index='' type='31'>" & xmlBlock & "</ELT></IODATA>"
'Response.Write(xmlBlock)
'Response.Write(strEltGuid)
objRQL.ServerExecuteXML xmlData, rqlError
If rqlError <> "" Then
Response.Write rqlError
Else
strAnswer = "strResponse=Just a test!   How strange. ..."
Response.Write (strAnswer)
'Response.Write "strResponse=Just a test!   How strange. ..."
'Response.Write 	 "Saved successfully."			'"Saved successfully."  							'
End If

'Response.Write "strResponse=Just a test!   How strange. ..."


'------------------
'Be a good citizen
'------------------

Set objRQL = Nothing

%>
</body>
</html>

Open in new window

0
 
LVL 12

Accepted Solution

by:
scooby_56 earned 500 total points
ID: 34967980

 With Page.Response
            .Clear()
            .CacheControl = "no-cache"
            .ContentType = "text/xml" 'use "text/html" if not XML
            .Expires = -1
            .AddHeader("Pragma", "no-cache")
            .Write("<root><row></row></root>")
            .End() ' This should stop the rest of your html markup showing. Alternatively you could remove the markup from the page.
End With

Open in new window



Also take a look at another example here
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_26660161.html
0
 

Author Comment

by:toneDigital
ID: 34970279
Thanks!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question