1 Reply Latest reply on Apr 1, 2010 12:35 PM by Stormgully

    Flash Builder 4 - RemoteObjects

    Stormgully

      I'm having an issue with remoteobjects in flash builder 4. I built a simple little project to see if I could get remoteobjects working.

       

      I got the project working and the output folder resides on a web server on my local LAN (not the machine with flash builder installed).

       

      Here is the issue I am having...

       

      When I build the app from from flash builder 4 the project launches everything works fine. If I open the URL of the project on the web server from my machine with flash builder 4 on it the project works fine. If I open the URL from any other machine the calls to the remoteobject do not work. I've scoured the web and haven't seen anyone else run into this issue so I'm assuming its something I'm doing wrong.

       

      I am on a trial version of flash builder 4. I just wanted to mention that but I don't see how that could be the issue.

       

      I've tried both methods of defining the remoteobject endpoint (both at runtime as one of the MXML remoteobject properties, and via a services-config.xml using the compiler argument -services PathToConfigFile). In each case the project runs and works fine from the machine with flash builder 4 installed on it but just not any other machine. I've also tried defining the -context-root thinking that may have been the issue still no dice.

       

      Any help would be greatly apprecaited.

       

      I'm not sure how useful the code would be as the project does work but here it is in any event...

       

      APPLICATION FILE:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application

       

       

      xmlns:fx="http://ns.adobe.com/mxml/2009"

      xmlns:s="

      library://ns.adobe.com/flex/spark"

      xmlns:mx="

      library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

       

       

      <fx:Declarations>

       

       

      <!-- Place non-visual elements (e.g., services, value objects) here -->

       

       

      <s:RemoteObject id="testRO"

      source="

      TestRO"

      destination="

      TestRO"

      endpoint="

      endPoint.php"

      showBusyCursor="

      true">

       

       

      <s:method name="say" result="say_resultHandler(event)"/>

       

       

      </s:RemoteObject>

       

       

      </fx:Declarations>

       

       

      <fx:Script>

      <![CDATA[

       

       

      import mx.controls.Alert;

       

      import mx.rpc.events.ResultEvent;

       

       

      protected function say_resultHandler(event:ResultEvent):void

      {

      Alert.show(String(event.result));

      }

      ]]>

       

       

      </fx:Script>

       

       

      <s:TextInput x="73" y="73" id="repeatEntry"/>

       

       

      <s:Button x="209" y="73" label="Say" click="testRO.say(repeatEntry.text)"/>

       

      </s:Application>

       

      PHP ENDPOINT:

      <?php
      //Define error reporting for this application.
      error_reporting(E_ALL|E_STRICT);

      //Set the display_errors in the php.ini
      ini_set("display_errors","on");

      //Path to the Zend server.php file.
      require_once 'Zend/Amf/Server.php';

      //require your php class file ('DIRECTORY/CLASS.PHP').
      require_once 'TestRO.php';

      $server = new Zend_Amf_Server();

      //Class name for the server (Same as the php file name).
      $server->setClass("TestRO");
      //Handle request
      echo ($server->handle());
      ?>

       

       

      PHP CLASS FILE:

      <?php
      class TestRO
      {
          public function say($text)
          {
             if($text =="")
          {
         return "+++ Field left blank +++";
          } else {
            return "+++ ".$text." +++";
          }
          }
      }

       

        • 1. Re: Flash Builder 4 - RemoteObjects
          Stormgully Level 1

          I've resolved the issue sort of...

           

          I exported a release build then re-tested the application and it works fine. For some reason while the application is in debug mode the remoteobject method calls aren't working on any other machines on the network... I still have no idea why... is this a new feature to prevent folks from using the debug swf's in production?

           

          In flex 3 I'd give the PROJECT-debug URL to my manager so he could track my progress but I was using the httpservice class and it worked without issue. In any event if someone knows the answer or has any additional information it would be greatly appreciated.

           

          Thank-you.