Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-02-23
4
Medium Priority
?
586 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

609 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