Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default AMFPHP and Flex3

    Using AMFPHP and Flex3, got this remote object:.

    But, I'm getting an error:
    Client.Error.MessageSend
    Send Failed

    Don't know what caused it or anything.

    Any ideas??


    <mx:RemoteObject id="RosterService"
    source="Roster"
    destination="amfphp"
    fault="faultHandler(event)"
    showBusyCursor="true" >
    <mx:method name="getRoster"
    result="getRosterHandler(event)"
    fault="faultHandler(event)">
    <mx:arguments>
    <teamid>{teamid.text}</teamid>
    <teampin>{teampin.text}</teampin>
    </mx:arguments>
    </mx:method>
    </mx:RemoteObject>

    This code (in my mxml):

    [Bindable]
    private var dp:ArrayCollection;


    private function faultHandler(fault:FaultEvent):void
    {
    Alert.show(fault.fault.faultString, fault.fault.faultCode.toString());
    }


    private function getRosterHandler(evt:ResultEvent):void
    {
    dp = new ArrayCollection( ArrayUtil.toArray(evt.result) );
    }

    This control:
    <mx:DataGrid id="roster_list"
    x="10"
    y="61"
    width="345"
    dataProvider="{dp}" >
    <mx:columns>
    <mx:DataGridColumn headerText="playerid" dataField="playerid"
    visible="false"/>
    <mx:DataGridColumn headerText="Player Name" dataField="playername"/>
    <mx:DataGridColumn headerText="Jersey" dataField="jersey"/>
    <mx:DataGridColumn headerText="Age" dataField="age"/>
    </mx:columns>
    </mx:DataGrid>

    The PHP class returns a mySQL dataset or an error message:
    PHP Code:
    <?php
    class Roster
    {
    function Roster()
    {
    $this->methodTable = array(
    "getRoster" => array(
    "description" => "Returns a Team's Roster based on passed TeamID and
    TeamPIN",
    "arguments" => array("teamid", "teampin"),
    "access" => "remote"
    )
    );

    }

    function getRoster($teamid, $teampin)
    {
    include("/home/dbutil/dbconnect.inc");
    mysql_connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $pinsql = "SELECT PIN from teams WHERE id = $teamid";
    $pinquery = mysql_query($pinsql);
    if ((mysql_num_rows($pinquery) == 0) || (mysql_result($pinquery, 0) <>
    $teampin)) {
    return "You did not enter a valid PIN for the team selected, try again.";
    } else {
    $teamsql = "SELECT playerid, playername, jersey, age FROM players WHERE
    ".
    "teamid = $teamid ORDER BY jersey, age";

    $teamquery = mysql_query($teamsql);
    if (mysql_num_rows($teamquery) > 0) {
    return $teamquery;
    } else {
    return "There are no players for this team, to add players, click the
    Add Player button.";
    }
    }
    }
    }
    ?>

    I_DONT_WANT_A_NICK Guest

  2. Similar Questions and Discussions

    1. INSERT statements in AMFPHP
      I am unable to do an insert, despite a week of trying. Here is my AMFPHP class, with some passwords omitted: I think my error has to do with...
    2. AMFphp
      Hello, Is there anyone who has some experience with AMFPHP? (www.amfphp.org). I have trouble setting it up and I wonder if anyone has succeeded...
    3. migrating from php/mysql/amfphp to microsoft sql 2003
      Hi There Have running (internally) flash app with php/amfphp and mySQL Customer wants to migrate to SQL2003. I assume that this is possible, but...
    4. URGENT HELP: Flex 2 with PHP (amfphp)
      Hello. (sorry, but my english is not very well...) Can i developer a app using flex 2 with php(amfphp)? I need select data in mysql database...
    5. Flex2.0 and amfphp
      Hi guys, I've just start to give a look at Flex2.0 but I can't make my application working. I have a simple mxml page which connect to a php...
  3. #2

    Default Re: AMFPHP and Flex3

    More details on the error:

    code:
    Client.Error.MessageSend

    Message:
    Send failed

    Detail:
    Channel.Connect.Failed error NetConnection.Call.BadVersion: : url:
    'http://localhost/amfphp/gateway.php'


    I_DONT_WANT_A_NICK Guest

  4. #3

    Default Re: AMFPHP and Flex3

    Ok, I've installed amfphp-1.9.beta.20080120.zip and now it enters the getRosterHandler but nothing is shown in the grid.
    I_DONT_WANT_A_NICK Guest

Posting Permissions

  • You may not post new threads
  • You may 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