Pure Actionscript remoting with Coldfusion Components. Can this happen?

Posted on 2012-08-23
Last Modified: 2012-09-30

I am coding in pure Actionscript 3.0 (not Flex, not Flash Authoring Tool), and I use Coldfusion 9 for my server-side scripting.  I am trying to directly access my CFC from the Flash runtime.  I assume the best way to do this is to use the URLLoader and URLRequest classes on a CFC with access="remote". ?  

(Is this the best way to do this?  I've heard a little about Flash Remoting, but I've also heard that it's only for Flex developers.??)

I have attached my simple code that I thought would work, but my trace statement outputs the ENTIRE .cfc code rather than just what I'm trying to return.  I'm clearly missing something.

Please help.  I just want to get the value RETURNED by the CFC, not the CFC itself. :)

Thank you.
Question by:chaseivey

    Author Comment


    I realized that my URLRequest object needed to begin with "http://myhostname" rather than use a relative URL reference "../../" in order for the request to happen the right way.  

    However, I noticed that Coldfusion always returns in wddxpacket, which I suppose is merely XML that can be parsed by AS3 ?

    Still need to know if I'm going about this the right way, or if there is a better way for AS3 to communicate with CFCs.  :)  ?
    LVL 12

    Accepted Solution

    You could use a NetConnection like this:

    private var _gateWay:NetConnection;
    protected function application1_creationCompleteHandler(event:FlexEvent):void {
    	_gateWay = new NetConnection();
    	_gateWay.objectEncoding = ObjectEncoding.AMF3;
    	_gateWay.connect("");"HelloWorld.SayHello", new Responder(onResult, onFault));
    private function onResult(evt:Object):void {
    	trace ("RESULT: " + evt)    
    private function onFault(evt:Object):void {
    	trace("FAULT " + evt.error);

    Open in new window

    If you compile using the Flex SDK and import mx.remoting.* then you should also be able to do it using the Flash Remoting approach, and anything else that doesn't have dependancies on the Flex display hierarchy.

    Author Closing Comment

    Thank you for your help.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
    The goal of the tutorial is to teach the user how to how to record live broadcast.
    The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now