Introduction to Flash Remoting with Fluorine
Published on July 7th, 2006 by DannyT. Filed under UncategorizedFluorine is an excellent open source project for .net developers as an alternative to Adobe’s commercial remoting tool. I have noticed there isn’t too much documentation out there for .net users wishing to get into remoting as opposed to the php offering amfphp so thought i’d contribute.
What is Fluorine?
Fluorine is an open source solution for achieving remoting on the .net platform created by Zoltan Csibi. More info at http://fluorine.thesilentgroup.com. There is the download, a mailing list and some useful documentation. Another resource that I hope to be adding to over the coming weeks is at osflash
Installing the remoting components
If you’ve never developed for flash remoting in the past you’ll need to install the Flash Remoting components, these don’t come installed as standard in either the standard or pro versions of Flash mx2004 or Flash8. you can download the components here: http://www.adobe.com/products/flashremoting/downloads/components/ which should be a simple case of double click installation. Included in these components are the following:
NetConnection Debugger – very useful swf that displays requests between application and server
Service Browser – another swf used for browsing available remoting services and methods that are available
Remoting help files – F1 to view
Remoting libraries – within the flash IDE click Window, Other Panels, Common Libraries, Remoting. Within this library are two compiled clips that need to be in the library of any remoting movie.
Installing Fluorine
Installing Fluorine is very easy. Simply download the latest version from fluorine.thesilentgroup.com and extract it to your usual visual studio projects folder. That’s it!
Hello World
Now an introduction tutorial wouldn’t be an introduction tutorial without a hello world example would it? Within Visual Studio create new c# web application and call it “FluorineTest”
Right click the project in the solution explorer and select “add reference”
in the .net tab click browse and navigate to [downloadedFluorineFolder]\com.TheSilentGroup.Fluorine\bin\Debug\com.TheSilentGroup.Fluorine.dll and OK back.
Next add the following lines to web.config within the <system.web> tags:
[html]
[/html]
Add a new class to the project and call it “HelloWorld”, copy and paste the following code:
[csharp]using System;
namespace FluorineTest
{
///
/// Summary description for HelloWorld.
///
public class HelloWorld
{
public HelloWorld()
{
//Constructor – does nothing
}
public string serverFunction(string sMessage)
{
return “our server received and returned: ” + sMessage;
}
}
}[/csharp]
Add new blank webform to project and call it “Gateway.aspx”
Thats our service created, we can now build the project!
Now for our flash application create a new flash document
Go into Window, Other Panels, Common Libraries, Remoting and drag RemotingClasses and RemotingDebugClasses onto the stage.
Next copy and paste the following code on the first frame of the movie:
[as]import mx.remoting.*;
import mx.rpc.*;
import mx.remoting.debug.NetDebug;
NetDebug.initialize();
var _service:Service = new Service(“http://localhost/FluorineTest/Gateway.aspx”, null, ‘FluorineTest.HelloWorld’, null , null);
var pc:PendingCall = _service.serverFunction(“Hello World!”);
pc.responder = new RelayResponder(this, “handleResult”, “handleError”);
function handleResult(re:ResultEvent)
{
trace(‘The result is: ‘ + re.result);
}
function handleError(fe:FaultEvent)
{
trace(‘There has been an error’);
}[/as]
Now run the movie and that should be it! Post any problems to the comments on the Fluorine tutorial blog entry and i’ll try help as best I can. Alternatively sign up the the mailing list.

DannyT
December 12th, 2006 at 3:15 am
It appears the new theme doesn’t play too nicely with the code views, if you’re having this problem switch the code to plaintext by clicking the grey bar at the top of each block of code.
I’ll try and sort this out asap
sajid
December 18th, 2006 at 7:07 am
Thanks Guyz for creating some good resource for Learners,
well I will love to see other work as well related to .net and flex specialy DataBinding ..
Thanks
Erny
December 18th, 2006 at 1:43 pm
great start !!!!!
I’ll wait for the next tutorial
Strappy
December 24th, 2006 at 10:12 pm
Good man DannyT!
Andrew
March 6th, 2007 at 5:21 pm
Is this for .net 1.1 or .net 2.0???
DannyT
March 23rd, 2007 at 1:35 am
Andrew, this should work for either, there isn’t any 2.0 specific code in there. Fluorine works with 1.1 and 2.0
gerard
May 2nd, 2007 at 8:31 am
great tutorial but is it possible to see your services in the servicebrowser using classes in the same project?
grtz
Lewis
July 19th, 2007 at 2:59 am
Thank you so much for posting this tutorial. It works great! Do you know how to send a dataset to flash?
Onur ACUN
July 29th, 2007 at 3:43 pm
TeÅŸekkürler adamım… Harika bir baÅŸlangıç…
Onur ACUN
July 29th, 2007 at 3:44 pm
In English : Thank man… It is a great start…
Flashcrafts.net
October 7th, 2007 at 11:16 pm
having problems running Fluorine with vista, iis7, .net 2
check out this tutorial
Flashcrafts.net
October 7th, 2007 at 11:17 pm
http://yasserblog.blogspot.com/2007/10/fluorine-with-as3-net-2-spoonfeeder.html