Código Flex :
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:valueObjects="valueObjects.*" xmlns:empresaservice="services.empresaservice.*">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
protected function button_clickHandler(event:MouseEvent):void
{
empresas.nombre = nombreTextInput.text;
empresas.apellido = apellidoTextInput.text;
empresas.apellido2 = apellido2TextInput.text;
empresas.depenoemp = depenoempTextInput.text;
empresas.telefonos = telefonosTextInput.text;
empresas.email = emailTextInput.text;
empresas.referencia = referenciaTextInput.text;
empresas.asunto = asuntoTextInput.text;
empresas.seguimiento = seguimientoTextInput.text;
empresas.fecha = fechaTextInput.text;
llamandofuncion(empresas);
}
protected function llamandofuncion(nuevaempresa:Empresa):void{
createEmpresaResult.token = empresaService.createEmpresa(nuevaempresa);
}
]]>
</fx:Script>
<s:states>
<s:State name="State1"/>
</s:states>
<fx:Declarations>
<valueObjects:Empresa id="empresas"/>
<s:CallResponder id="createEmpresaResult" activate="createEmpresaResult_activateHandler(event)"/>
<empresaservice:EmpresaService id="empresaService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Form defaultButton="{button}" x="93" y="60">
<mx:FormItem label="Nombre">
<s:TextInput id="nombreTextInput" text="{empresas.nombre}"/>
</mx:FormItem>
<mx:FormItem label="Apellido">
<s:TextInput id="apellidoTextInput" text="{empresas.apellido}"/>
</mx:FormItem>
<mx:FormItem label="Apellido2">
<s:TextInput id="apellido2TextInput" text="{empresas.apellido2}"/>
</mx:FormItem>
<mx:FormItem label="Depenoemp">
<s:TextInput id="depenoempTextInput" text="{empresas.depenoemp}"/>
</mx:FormItem>
<mx:FormItem label="Telefonos">
<s:TextInput id="telefonosTextInput" text="{empresas.telefonos}"/>
</mx:FormItem>
<mx:FormItem label="Email">
<s:TextInput id="emailTextInput" text="{empresas.email}"/>
</mx:FormItem>
<mx:FormItem label="Referencia">
<s:TextInput id="referenciaTextInput" text="{empresas.referencia}"/>
</mx:FormItem>
<mx:FormItem label="Asunto">
<s:TextInput id="asuntoTextInput" text="{empresas.asunto}"/>
</mx:FormItem>
<mx:FormItem label="Seguimiento">
<s:TextInput id="seguimientoTextInput" text="{empresas.seguimiento}"/>
</mx:FormItem>
<mx:FormItem label="Fecha">
<s:TextInput id="fechaTextInput" text="{empresas.fecha}"/>
</mx:FormItem>
<s:Button id="button" label="Submit" click="button_clickHandler(event)"/>
</mx:Form>
</s:Application>
