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
Solved

Returning results from remoteobject class to parent

Posted on 2014-11-12
1
233 Views
Last Modified: 2015-05-12
I have a Flex application using ColdFusion to retrieve data from MS SQL. I'm trying to create a class where I can send in a numeric argument and it returns a value to the document calling the class.

This is my class

package com.procost
{
import mx.controls.Alert;
    import mx.core.FlexGlobals;
    import mx.rpc.AbstractOperation;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.remoting.RemoteObject;

    public class EmailListRetrieve
    {
        public var emailListId:Number = -1;

        public function send():void{
            //Create the remote object
            var _remoteObject:RemoteObject = new RemoteObject('test');
            _remoteObject = new RemoteObject("ColdFusion");
            _remoteObject.endpoint = "http://" + FlexGlobals.topLevelApplication.endPointLink + "/flex2gateway/";
            _remoteObject.source = FlexGlobals.topLevelApplication.remotePath + "services.general";
            _remoteObject.showBusyCursor = true;

            //Send
            var op:AbstractOperation = _remoteObject.getOperation('getEmailList');
            op.addEventListener(ResultEvent.RESULT, result);
            op.send(this);
        }

        // Result from CFC
        private function result(event:ResultEvent){
            Alert.show(event.result.toString());
        }
    }
}

Open in new window


This is how I'm calling it from my MXML file

import com.procost.EmailListRetrieve;    

public function fncClick():void{
     var request:EmailListRetrieve = new EmailListRetrieve();
     request.emailListId=1;
     request.send();
}

Open in new window


The result function in my class is returning all the data I need from the DB. The issue is, how do I get this data back into the MXML document I called it from?

Any help would be appreciated.
0
Comment
Question by:RenAndStimpy
1 Comment
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 500 total points
ID: 40439130
After your get result in, assuming you have public variable defined to hold the returned value, got can add
get method

For example:

      public var returnedValue:String;

       // Result from CFC
        private function result(event:ResultEvent){
            Alert.show(event.result.toString());
            setReturnedValue(event.result as String);
        }

       public function setReturnedValue(str:String):void {
             returnedValue = new String (str);
       }
       public function getReturnedValue():String {
             return returnedValue;
       }
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

Suggested Solutions

Title # Comments Views Activity
What is assert.deepEqual? 4 53
Bulk Reorder File Names 4 69
script issue to add permissions to the registry hive 2 43
Powershell  and PSExec = Password failure 5 24
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

809 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