Professional Web Applications Themes

Result not displaying in Flash - Coldfusion Flash Integration

I am trying to get the results of a cfquery to display in Flash. From what I understand, it should be simple. I have the code below. The results show as [object, Object]. What am I doing wrong? Please help. Action Script: import mx.remoting.NetServices; import mx.remoting.NetDebug; mx.remoting.debug.NetDebug.initialize(); import mx.remoting.DataGlue; //set the default gateway URL NetServices.setDefaultGatewayUrl("http://66.241.245.41/flashservices/gateway"); var gw = NetServices.createGatewayConnection(); var server = gw.getService("epic.intro", new Result()); server.getintro(); function Result() { //receives data returned from the method this.onResult = function(result) { //trace("Data received from server : " + result); //this is where we put the data in the text field introView.text = ...

  1. #1

    Default Result not displaying in Flash

    I am trying to get the results of a cfquery to display in Flash. From what I
    understand, it should be simple. I have the code below. The results show as
    [object, Object]. What am I doing wrong? Please help.

    Action Script:

    import mx.remoting.NetServices;
    import mx.remoting.NetDebug;
    mx.remoting.debug.NetDebug.initialize();
    import mx.remoting.DataGlue;

    //set the default gateway URL
    NetServices.setDefaultGatewayUrl("http://66.241.245.41/flashservices/gateway");

    var gw = NetServices.createGatewayConnection();
    var server = gw.getService("epic.intro", new Result());
    server.getintro();

    function Result()
    {
    //receives data returned from the method
    this.onResult = function(result)
    {
    //trace("Data received from server : " + result);
    //this is where we put the data in the text field
    introView.text = result;
    }

    this.onStatus = function(error)
    {
    //trace("Error : " + error.description);
    //this is where we put the data in the text field
    introView.text = "Error : " + error.description;
    }
    }


    Component:

    <cfcomponent displayname="retrieveIntro">

    <cffunction name="getintro" access="remote" returntype="query">


    <cfquery datasource="epic" name="qgetintro">
    Select intro
    from intro
    </cfquery>

    <cfreturn qgetintro>

    </cffunction>

    </cfcomponent>

    Gregory Nelson Guest

  2. #2

    Default Re: Result not displaying in Flash

    The result is a recordset (object) so you can't assign it like that.

    Lets assume that the recordset has only one record, then

    introView.text = results.getItemAt(0).columnName;

    Where columnName is the name of the column in the query result set you want to
    assign to the field.

    Ken



    The ScareCrow Guest

  3. #3

    Default Re: Result not displaying in Flash

    Thanks. What if the table has multiple records to return?


    Gregory Nelson Guest

  4. #4

    Default Re: Result not displaying in Flash

    In the event the returned recordset has more than one record, it would depend
    upon how you are going to display them.

    If you use a grid, then
    gridName.dataProvider = results;

    If using form fields, you can loop through the recordset

    if(var x = 0 ; x < results.legth; x++){
    do something.............
    }

    Ken

    The ScareCrow Guest

  5. #5

    Default Re: Result not displaying in Flash

    Ok. I got it to display the last record in the text field, but I want all of
    the records. How would I modify this?

    function getconprojects_Result(result){

    for(var i = 0 ; i < result.length; i++){
    var record = result.getItemAt(i);
    _root.Instancename_3.htmlText = ("" + record.project + "" +"<br>"+
    record.location);

    }

    }

    Gregory Nelson Guest

  6. #6

    Default Re: Result not displaying in Flash

    Assuming you want to display them all in the text field, see attached code

    Ken

    function getconprojects_Result(result){
    var textString = "";
    for(var i = 0 ; i < result.length; i++){
    var record = result.getItemAt(i);
    textString = textString + "<strong>" + record.project + "</strong>" +"<br>"+
    record.location + "<br>";
    }
    _root.Instancename_3.htmlText = textString;
    }

    The ScareCrow Guest

Similar Threads

  1. problems with displaying the result.cfm page
    By vasoulitsa in forum Coldfusion Database Access
    Replies: 21
    Last Post: September 16th, 10:37 AM
  2. Result XML page not displaying
    By mareal in forum ASP.NET Web Services
    Replies: 0
    Last Post: June 8th, 01:41 PM
  3. displaying query result of 0 as N/A
    By eggwater in forum Macromedia ColdFusion
    Replies: 3
    Last Post: May 10th, 11:34 AM
  4. Replies: 5
    Last Post: August 11th, 02:56 PM
  5. displaying result from VBA into a control of form
    By mk sabeel in forum Microsoft Access
    Replies: 6
    Last Post: July 24th, 02:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139