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.
The Quick Flash Remoting Fix (and simple Flex Sample) for Tartan Sample Application article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
Taking the helloWorld example, either:
- Copy the
configfolder intartanSamples\helloWorldtotartanSamples\helloWorld\remote, or - Alter line 28 of
tartanSamples\Application.cfcto readconfigFileLocation="#ExpandPath('../config/service.xml')#"(note the added "../" at the start of the path.)
Also, I don't believe that there are any Flash or Flex samples for using Tartan with Flash Remoting (it's actually dead simple) so here's the simplest possible Flex example:
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>
I look forward to working with Tartan on our current Flex/CF project. We will be using it in conjunction with Model-Glue on the server side and, of course, Arp on the client :)
The Quick Flash Remoting Fix (and simple Flex Sample) for Tartan Sample Application article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
Thanks for finding the bug and putting the sample flash remoting code together. I fixed the bug in the HelloWorld app, and I figure I can use the mxml in the Tartan sample code.
[...] Quick Flash Remoting Fix (and simple Flex Sample) for Tartan Sample Application at Aral Balkan l Balkan Rediscovering fun! Blog Archives SWX Twitter Badge The SWX Twitter badge requires Flash player 8+. This little widget displays my friend’s updates from Twitter. It uses SWX, a new data exchange format for Flash that works with SWF files. You load [...]