meddlingwithfir
09-10-2007, 08:26 PM
I'm taking my first stab at using the mx.remoting.Service class -- I have been using the deprecated NetServices for all my past projects.
I'm running into a pretty basic stumbling block. I've got some test code running:
import mx.remoting.*;
import mx.rpc.*;
// VARIABLES
var GATEWAY_URL:String = "http://[domainName]/flashservices/gateway/";
var COMPONENT_PATH:String = "components.flashgallery";
// Set up the connection Service
var myService:Service = new Service(
GATEWAY_URL,
null,
COMPONENT_PATH,
null,
null
);
var pc:PendingCall = myService.selectFlashGalleryData(1);
// Tell the service what methods handle result and fault conditions
pc.responder = new RelayResponder(this, "selectFlashGalleryData_Result", "selectFlashGalleryData_Fault" );
function selectFlashGalleryData_Result(re:ResultEvent):void
{
// Display successful result
trace("Got Results.");
// messageDisplay.text = re.result.HELLOMESSAGE;
// timeDisplay.text = re.result.TIMEVAR;
}
function selectFlashGalleryData_Fault(fe:FaultEvent):void
{
// Display fault returned from service
trace("Got Errors.");
// messageDisplay.text = fe.fault;
}
But when I compile, I get the following errors:
The class or interface 'Service' could not be loaded.
The class or interface 'PendingCall' could not be loaded.
The class or interface 'ResultEvent' could not be loaded.
The class or interface 'FaultEvent' could not be loaded.
So it seems that my imports early up don't seem to be working? My publish settings are for Flash Player 8, Actionscript 2.0.
Is there something I'm missing in my code, or have I set up my publish settings incorrectly?
Thanks!
I'm running into a pretty basic stumbling block. I've got some test code running:
import mx.remoting.*;
import mx.rpc.*;
// VARIABLES
var GATEWAY_URL:String = "http://[domainName]/flashservices/gateway/";
var COMPONENT_PATH:String = "components.flashgallery";
// Set up the connection Service
var myService:Service = new Service(
GATEWAY_URL,
null,
COMPONENT_PATH,
null,
null
);
var pc:PendingCall = myService.selectFlashGalleryData(1);
// Tell the service what methods handle result and fault conditions
pc.responder = new RelayResponder(this, "selectFlashGalleryData_Result", "selectFlashGalleryData_Fault" );
function selectFlashGalleryData_Result(re:ResultEvent):void
{
// Display successful result
trace("Got Results.");
// messageDisplay.text = re.result.HELLOMESSAGE;
// timeDisplay.text = re.result.TIMEVAR;
}
function selectFlashGalleryData_Fault(fe:FaultEvent):void
{
// Display fault returned from service
trace("Got Errors.");
// messageDisplay.text = fe.fault;
}
But when I compile, I get the following errors:
The class or interface 'Service' could not be loaded.
The class or interface 'PendingCall' could not be loaded.
The class or interface 'ResultEvent' could not be loaded.
The class or interface 'FaultEvent' could not be loaded.
So it seems that my imports early up don't seem to be working? My publish settings are for Flash Player 8, Actionscript 2.0.
Is there something I'm missing in my code, or have I set up my publish settings incorrectly?
Thanks!