Groups

Group Admins
  • Profile Photo
    camille
  • Profile Photo
    Ariel Sommeria-Klein

amfPHP Users

Public Group  |  active 7 months, 3 weeks ago ago

This forum is not active anymore, please ask your questions on stackoverflow

Send object from Flash to amfPHP

Viewing 1 - 4 of 4 posts
  • Rob

    said

    I’m a noob, trying to send an object from Flash to amfPHP 2.0.1. If I send a simple string there are no problems, but when I try to send a “complex” object to amfPHP, I get the dreaded “NetConnection.Call.BadVersion” error.

    I’ve read the documentation multiple times and, quite frankly, it could use some serious improvement, so I hope someone on the forum can help.

    Following is my very simple ActionScript and PHP code in its entirety. What am I doing wrong here?

    ===== ActionScript Code =====
    package
    {
    import flash.display.*;
    import flash.net.*;

    public class AMFPHPTest extends Sprite
    {
    private var netConnection:NetConnection;

    public function AMFPHPTest()
    {
    var movieObject:Object = new Object();
    movieObject.movie = “Aliens”;

    netConnection = new NetConnection();
    netConnection.connect(“http://localhost/web/amf/AmfPHP/”);
    netConnection.call(“Init/launchApp”, new Responder(onResult, onFault), movieObject);
    }

    private function onResult(response:Object):void
    {
    if (response.hasOwnProperty(“response”))
    {
    trace(“Now you’re cooking…”);
    }
    }

    private function onFault(response:Object):void
    {
    trace(“Got a fault…”);
    }
    }
    }

    ===== PHP Code =====
    response = $responseString;
    }
    }

    ?>

  • Rob

    said

    Well, since my PHP code got cut off by this shitty forum, here’s the PHP code without the php tags:

    class Init
    {
    public function launchApp($movieObject)
    {
    if (strcmp($movieObject[‘movie’], ‘Aliens’) == 0)
    return new ResponseObject(‘Your favorite movie…’);
    else
    return new ResponseObject(‘Not your favorite movie…’);
    }
    }

    class ResponseObject
    {
    public $response;

    public function __construct($responseString)
    {
    $this->response = $responseString;
    }
    }

  • Rob

    said

    By the way, can anyone recommend an alternative to amfPHP? I’m about ready to give up on this shit.

Viewing 1 - 4 of 4 posts

Upcoming Events / Événements à venir

  1. Haxepéro #21 : Apéropen Source

    29 January @ 19:00 - 23:00
  2. Atelier Silex #1 Hello World à Silicon Banlieue

    2 February @ 13:30 - 17:30
  3. Atelier Silex #2 Hello World à Silicon Banlieue

    5 February @ 13:30 - 17:30

Sign up for Silex Labs newsletter

Follow Silex Labs on Twitter

Silex Labs community Tweets

Facebook page

Enter your email address to subscribe to this blog and receive notifications of new posts by email.