Wait..CFCs have methods, not operations....

So do I remove the Operation variables and just create a function like:

        public function create(petData:Object):void {
            ro.create(petData);
            ro.create.addEventListener(FaultEvent.FAULT, faultHandler);         
       
           ....
        }

----------------------------------------
From: "wkolcz" <[email protected]>
Sent: Friday, January 02, 2009 2:45 PM
To: [email protected]
Subject: [flexcoders] AS3 RemoteObjects and Operations 

Thank you to those that have taken the time to try to help me understand AS 
RemoteObjects. Its much more detailed than the mxml version, but that is why I 
want to learn it. Having said that...

When creating a DAO Class for CRUD, is it necessary / best practice declare the 
operation name? I don't see it declared in the few examples online that I can 
find for creating RemoteObjects in AS. For example, is this right for a set up?

package com.isavepets.data
{
    import mx.rpc.events.FaultEvent;
    import mx.rpc.remoting.Operation;
    import mx.rpc.remoting.RemoteObject;

    public class PetDAO
    {

        private var ro:RemoteObject;
        private var create:Operation;
        private var read:Operation;
        private var update:Operation;
        private var deletePet:Operation;

        public function PetDAO()
        {
            var ro:RemoteObject = new RemoteObject();
            ro.destination = "ColdFusion";
            ro.source = "com.isavepets.pets.petDAO";
            ro.addEventListener(FaultEvent.FAULT, faultHandler);
        }

    }
}

Then build functions off of them:

public function create(petData:Object):void {
    var create:Operation = new Operation(ro, "create");
    ro.create(petData):
}

Thanks again. trying to wrap my head about RemoteObjects and how to create them 
in one Class that my app can use over and over.


Reply via email to