dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: flash remoting & flash.net?

  1. #1
    Junior Member
    Join Date
    May 2008
    Location
    Hawaii
    Posts
    27

    Post flash remoting & flash.net?

    Hi, I am trying, but not getting it

    I am trying to convert a as2 remoting test to AS 3 using the flash.net package.
    I am using a cfc as the backend. I have been having troubles getting flash remoting working with flash CS 3 and actionscript 3.

    I hope that somebody can help. I did see strike_remoting remoting package, but it is using PHP. I don't know PHP, so I use trying to use ColdFusion CFCs

    Is there anything wrong with this?
    Code:
    import flash.net.*;
    
    var myservice:NetConnection = new NetConnection();
    myservice.connect("http://localhost/flashservices/gateway");
    
    var responder:Responder = new Responder(onResult, onFault);
    
    function onResult(responder:Object):void{
    	trace(responder);
    }
    
    function onFault(responder:Object):void{
    	trace(responder);
    	
    }
    
    myservice.call("cfcs.getTest", responder);
    I can't seem to get the trace pannel working.

    The cfc is:
    Code:
    <cfcomponent displayName="getTest"> 
    <!-- Establish a Flash Remoting Connection --> 
    <cffunction name="getTestConn" access="remote" returnType="string" output="true">
    <cfreturn "....connection successful"> 
    </cffunction> 
    </cfcomponent>
    In actionscript 2 I used, which works perfect:
    Code:
    import mx.remoting.Service; 
    import mx.services.Log; 
    import mx.rpc.RelayResponder; 
    import mx.rpc.FaultEvent; 
    import mx.rpc.ResultEvent; 
    import mx.remoting.PendingCall; 
    import mx.remoting.RecordSet; 
    import mx.remoting.DataGlue; 
    
    // Connect to the Gateway 
    // Establish the Service 
    var myService: Service = new Service( "http://localhost/flashservices/gateway", new Log (Log.DEBUG), "cfcs.getTest", null, null); 
    //path to the cfc localhost/cfcs/GetTest.cfc
    
    //Test the Connection
    function getTestConn(){ 
    //Create a PendingCall object 
    var getTestConn_pc:PendingCall = myService.getTestConn();
    //Use the responder property to handle the success for failure 
    
    testConn_pc.responder = new RelayResponder(this, "getTestConn_Result","getTestConn_Fault");
    } 
    //Handle the Success 
    function getTestConn_Result(re:ResultEvent){ 
    trace(re.result); 
    } 
    //Handle the Failure 
    function getTestConn_Fault(fault:FaultEvent):Void{ 
    trace("error"); 
    } 
    // Start Application 
    getTestConn();
    which traced:
    Code:
    9/18 20:20:38 [INFO] : Creating Service for cfcs.getTest
    9/18 20:20:38 [INFO] : Creating gateway connection for http://localhost/flashservices/gateway
    9/18 20:20:38 [INFO] : Successfully created Service
    9/18 20:20:38 [INFO] : Invoking getTestConn on cfcs.getTest
    9/18 20:20:44 [INFO] : cfcs.getTest.getTestConn() returned "....connection successful"

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I am not very familiar with remoting but here is a thread, which may help you.

    http://board.flashkit.com/board/show...light=remoting
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Junior Member
    Join Date
    May 2008
    Location
    Hawaii
    Posts
    27
    Hi cancerinform,
    Thank you so much for your respond. I have asked this question all over, and you are the first to reply, thanks for that! I did download strike's package last night, even knowing that it was targeting phpamf. The actionscript is way over my head, and I am not sure how much is related towards php. I am going to write him on the other forum post to see if he can offer any help.

    I don't really want to learn another scripting language(php) just to use flash remoting. I am also trying to learn actionscript 3.0 so I was thinking that I should upgrade my remoting code.

    I guess if I can't figure this out, I will just keep using the actionscript 2 code, not like actionscript 2 is not being used any longer. Or maybe just use xml instead of remoting.

    It is frustrating that Adobe has not updated remoting with examples with the release of Flash CS 3. I could not find one example in the docs on using the flash.net package for remoting in this way.

    Thanks again for all your help, I am greatful for your responds`-`
    Johnny

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center