?
Solved

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

Posted on 2011-02-23
4
Medium Priority
?
584 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses

770 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