Thanks, that cleared the error on the AS page! Of course now I am getting an
error on my .mxml page.
TypeError: Error #1009: Cannot access a property or method of a null object
reference.
at com.isavepets.projects::ProjectGateway/list()
at ASRemoteObject/initApp()
Here is my .mxml script.
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import com.isavepets.projects.ProjectGateway;
[Bindable]
public var projectData:ArrayCollection = new ArrayCollection();
public var ProjGateway:ProjectGateway = new ProjectGateway();;
public function initApp():void {
projectData = ProjGateway.list();
}
]]>
</mx:Script>
Thanks!
----------------------------------------
From: "Dan Vega" <[email protected]>
Sent: Sunday, December 21, 2008 8:25 AM
To: [email protected]
Subject: Re: [flexcoders] ActionScript RemoteObject - Trying to learn so please
be patient :-)
Your RO variable is out of scope, you defined as a local variable to the
constructor. You need to set it up outside of there.
public class ProjectGateway {
private var RO:RemoteObject;
ProjectGateway()
{
RO = new RemoteObject();
RO.destination = "ColdFusion";
RO.source = "com.isavepets.projects.projectGateway";
RO.addEventListener(FaultEvent.FAULT, faultHandler);
var list:Operation = new Operation(RO, "list");
}
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');
}
}
}
Thank You
Dan Vega
[email protected]
http://www.danvega.org