>--- In [email protected], Jeffry Houser <[EMAIL PROTECTED]> wrote:
>
> How about some more information..
ok
> When you say "console" output are you referring to the Flex Builder
> debug console or the ColdFusion console?
I mean Flex Builder debug console
> I doesn't look to me like you're defining sendMailRO anywhere.
I'll do it
> Is "pvlive091.cfcs.mailer" located in your web root?
Yes
> How about showing us some ColdFusion code?
ok
> Instead of using a generic object, why not create a value object AS3
> and/or CFC to pass as a parameter back and forth between Flash and CF?
why? i do not know a lot about VOs.. I'll try to figure out why you say
that.
thank you!!
That's the code (there are some words in italian, sorry :))
mailer.cfc (webroot/PvLive091/cfcs/mailer.cfc)
<cfcomponent output="false">
<cffunction name="sendMail" returntype="Any">
<cfargument name="mailObject" required="true" type="Any">
<cfmail from="#mailObject.mittente#" to="#mailObject.address#"
subject="subject">#mailObject.BODY#</cfmail>
<cfreturn "email sent">
</cffunction>
</cfcomponent>
MXML (i'll show only the extended canvas component)
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400"
height="300" creationComplete="initRo(); initSendMailRO()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.remoting.RemoteObject;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
// THIS PART WORKS - FROM COLDFUSION TO FLEX
[Bindable]
private var user:Object;
private var userRO:RemoteObject;
private function initRo():void {
userRO = new RemoteObject();
userRO.source ="pvlive091.cfcs.getLoggedUserDetails";
userRO.destination = "ColdFusion";
userRO.getLoggedUserDetails.addEventListener("result",
getLoggedUserDetailsResultHandler);
userRO.addEventListener("fault", getLoggedUserDetailsFaultHandler);
userRO.getLoggedUserDetails();
}
private function
getLoggedUserDetailsResultHandler(event:ResultEvent):void {
trace('getLoggedUserDetailsResultHandler: ' + event);
user = event.result as Object
}
private function getLoggedUserDetailsFaultHandler(event:FaultEvent):void
{
trace ('getLoggedUserDetailsFaultHandler: ' + event);
Alert.show(event.fault.faultString, "Error:");
}
// THIS PART DOES NOT WORK: FROM FLEX TO COLDFUSION
private var sendMailRO:RemoteObject;
private var mailObject:Object;
private function initSendMailRO():void {
sendMailRO = new RemoteObject();
sendMailRO.source = "pvlive091.cfcs.mailer";
sendMailRO.destination = "ColdFusion";
sendMailRO.sendMail.addEventListener("result", sendMailResultHandler);
sendMailRO.addEventListener("fault" , sendMailFaultHandler);
}
private function buildMail():void {
mailObject = new Object;
mailObject.mittente = "xxx";
mailObject.destinatario = "xxx";
mailObject.address = "xxx";
mailObject.subject = "xxx";
mailObject.body = "xxx";
sendMailRO.sendMail(mailObject);
}
private function sendMailResultHandler (event:ResultEvent):void {
trace ('sendMailResultHandler: ' + event);
emailConfirmUiId.text = event.result as String
}
private function sendMailFaultHandler (event:FaultEvent):void {
trace ('sendMailFaultHandler: ' + event);
Alert.show(event.fault.faultString, "Error:");
}
]]>
</mx:Script>
<mx:Text x="45" y="106" text="Nome"/>
<mx:Text x="45" y="132" text="Cognome"/>
<mx:TextInput x="145" y="104" id="nomeUiId" text="{user.FIRSTNAME}"/>
<mx:TextInput x="145" y="130" id="cognomeUiId" text="{user.LASTNAME}"/>
<mx:TextInput x="145" y="181" id="emailUiId" text="{user.EMAIL}"/>
<mx:Text x="118.5" y="47" text="Invia pdf" width="163"
textAlign="center"/>
<mx:Text x="45" y="183" text="email"/>
<mx:Button x="167" y="230" label="InviaButtonUiId" click="buildMail()"/>
<mx:Text x="185" y="260" id="emailConfirmUiId"/>
</mx:Canvas>
And that is the full output of the Flex Builder console when i click the
button:
[SWF] /PvLive091/bin/PvLive091.swf - 1.295.554 bytes after decompression
getLoggedUserDetailsResultHandler: [ResultEvent
messageId="4AFEB3D3-D90C-E589-0D8B-648ADB4D6447" type="result"
bubbles=false cancelable=true eventPhase=2]
sendMailFaultHandler: [FaultEvent fault=[RPC Fault faultString="Unable
to invoke CFC - The MAILOBJECT parameter to the sendMail function is
required but was not passed in." faultCode="Server.Processing"
faultDetail=""] messageId="4AFEC7A5-170B-3631-FC97-165103219205"
type="fault" bubbles=false cancelable=true eventPhase=2]