ColdFusion 9.0 Resources |
Using the Pop classThe Pop class is the proxy for the ColdFusion Pop service, which provides the functionality of the cfpop tag. You specify the cfpop action and required attributes as Pop object properties and call the object execute() function to run the service. The following example shows the user each supported action: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:cf="coldfusion.service.mxml.*" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.controls.Alert; import coldfusion.service.events.*; public function init():void { poptest.execute(); } public function handleResult(event:ResultEvent):void { Alert.show("Success" + event.toString()); } public function handleError(event:FaultEvent):void { Alert.show("Failure"); } public function handleGetAll(event:ResultEvent):void { var res:Array = event.result as Array; for(var i:uint = 0; i < res.length; i++) { var key:String; for(key in res[i]) { trace("object key = " + key.toString()); if(res[i][key] != null) { trace("object value = " + res[i][key].toString()); } } } } ]]> </mx:Script> <cf:Config id="configid" cfServer="localhost" cfPort="8500" servicePassword="service" serviceUserName="service" /> <!--<cf:Pop id="poptest" action="getall" result="handleGetAll(event)" host="10.192.36.227" userName="failoveruser" password="password" fault="handleError(event)"/>--> <!--<cf:Pop id="poptest" action="getheaderonly" result="handleGetAll(event)" host="10.192.36.227" userName="failoveruser" password="password" fault="handleError(event)"/>--> <cf:Pop id="poptest" action="delete" messageNumber="25" host="10.192.36.227" userName="failoveruser" password="password" result="handleResult(event)" fault="handleError(event)" /> </mx:Application> |