I am trying to wrap my head around trying to move my RemoteObjects out
of <mx:Script> and into a AS Class File. I thought I would put
all the set up code in the constructor and then just have functions
that call methods on the instantiated RemoteObject. I am getting errors
(as to be expected from a Noob).

Can someone help me learn how
this is done? I have a CFC set up in the directory as I have done a
thousand times before when I was using <mx:RemoteObject>. It
works fine.

Below is my code for the .as. I am getting this error:
 Access of undefined property RO (ProjectGateway.as)
Thank for any information and education!

                                        ProjectGateway.as
package com.isavepets.projects
{
     import mx.collections.ArrayCollection;
     import mx.controls.Alert;
     import mx.rpc.events.FaultEvent;
     import mx.rpc.remoting.Operation;
     import mx.rpc.remoting.RemoteObject;

     public class ProjectGateway
     {
          public function ProjectGateway()
          {
               var RO:RemoteObject = new RemoteObject();
               RO.destination = "ColdFusion";
               RO.source = "com.isavepets.projects.projectGateway";
               RO.addEventListener(FaultEvent.FAULT, faultHandler);
               var list:Operation = new Operation(RO, "list");
          }

          public function list():ArrayCollection {
               var projectData:ArrayCollection = RO.list();
               return projectData;
          }

          private function faultHandler(e:FaultEvent):void {
               Alert.show(e.fault.message, 'Project Gateway Error');
          }

     }
}

----------------------------------------

Close Window

Reply via email to