Flex supports Flash Remoting as well as web services and the best bit is that calling out to .NET objects is a breeze. In order to use Flash Remoting to call out to .NET objects you will need Flash Remoting installed server side. This article shows how to use Macromedia's soloution but you could also use Flash ORB .
With Flash Remoting installed I will use the default folder that it sets up, setting up your own is easy though. So first things first we create our .NET assembly.
Public Class RemotingTests
'returns what ever value is passed
Public Function EchoString( ByVal strValue As String )
This code echos back what ever value is passed. Note the inclusion of the Flashgateway.IO namespace, this is sourced from the flashgateway.dll assembly that you must referance. With this compiled copy the assembly into the bin folder of the default samples folder that the Flash remoting setup sets up. The next step is to add the Flash Remoting gateway to Flex. Open up your applications flex-config.xml file and add your gateway as follows.
<mx:Button click="test.EchoString('Flex and Flash Remoting rocks')">
Here I have created a simple Flex app that calls out to our .NET object via Flash Remoting passing a hard coded value. Note that the source attribute points to the .NET object fully referanced, that is any namespace names and then the class name (we will assume the default namespace for our .NET object is FlashRemotingCode).