Quick Flash Remoting Fix (and simple Flex Sample) for Tartan Sample Application
The HelloWorld sample application that ships with Tartan has a small bug that might leave you scratching your head when you try to access them via Flash Remoting. It's a minor path issue which you can fix in two ways.
Taking the helloWorld example, either:- Copy the
config
folder intartanSamples\helloWorld
totartanSamples\helloWorld\remote
, or - Alter line 28 of
tartanSamples\Application.cfc
to readconfigFileLocation="#ExpandPath('../config/service.xml')#"
(note the added "../" at the start of the path.)
MXML:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" load="initForm()"> <mx:Button label="Get greeting" click="getGreeting()" /> <mx:Label id="status" /> <mx:Script> <![CDATA[ import mx.remoting.Service; import mx.remoting.PendingCall; import mx.rpc.RelayResponder; import mx.rpc.ResultEvent; import mx.rpc.FaultEvent; import mx.remoting.debug.NetDebug; var helloWorldService:Service; function initForm() { NetDebug.initialize(); var gatewayURL:String = "http://localhost:8500/flashservices/gateway"; helloWorldService = new Service ( gatewayURL, null, "tartanSamples.helloWorld.remote.HelloWorldFlashService", null, null ); status.text="Initialized."; } function getGreeting() { var pendingCall = helloWorldService.getGreeting ( "English" ); pendingCall.responder = new RelayResponder(this, "onResult", "onStatus"); } function onResult (resultObj:ResultEvent) { status.text = resultObj.result; } function onStatus ( faultObj:FaultEvent ) { status.text = "There was an error getting the greeting."; } ]]> </mx:Script> </mx:Application>
Comments
by pkenney on 2005-09-03 22:30:46
by Sample Article Of Incorporation by Hall Newspapers on 2007-10-31 17:42:22