Running Flash remoting sample on .NET

When running the Flash remoting sample on .NET, for example, http://localhost/flashremoting/samples/html/default.htm
you may see the page displaying “Loading … â€?, and hanging there forever. What’s the problem?

Well, here is a check list for this issue:
1. make sure you have the Microsoft .NET Framework SDK 1.1 installed on your machine. Flash Remoting will not work properly without the SDK.

2. In IIS console, right click on flahsremoting directory, make sure the URL is point to c:\inetpub\wwwroot\flashremoting, and click on the “Createâ€? beside the “Application nameâ€?, to make it a web app. And then restart the IIS.

3. Because the .net is compiling everything when you request a page at the first time, so it may take a while to display the content. So you need to make sure you leave enough time for the sample to process. Leave it there for 2 to 3 minutes to make sure it has enough time to run through before you cancel it.

Step 2 is the important one. In general, the installation should create the flashremoting as a web site. But sometimes that doesn’t happen, so you need to manually change it in the IIS console as described in step 2.

Make Flash Remoting work with Flash MX 2004

Do you find that the flash remoting code you developed using Flash MX doesn’t work with Flash MX 2004? If you do, you are not alone. The following explains why it is not working and how to make it work again.

Basically, the reason your code doesn’t work in Flash MX 2004 is because your code was written in ActionScript 1.0, but Flash MX 2004 is using ActionScript 2.0.

JRun installation includes some flash remoting samples. These samples seams to work with Flash MX and Flash MX 2004. Those samples were written in AS 1.0, how come they work with Flash MX 2004? The answer is because the samples included the compiled swf files. If you rename or delete the swf files, and try to compile those samples in Flash MX 2004, you will get compile error.

To make the code written in AS 1.0 to work with Flash 2004, you need to install “Flash Remoting Components ActionScript 1.0 for Flash MX 2004 and Flash MX Professional 2004â€? FlashRemotingComponents-win-en.exe from

If you are writing new code, it is the best to write in AS2.
To use the AS2.0 version you, you need to download the flashremoting_comp_as20-win-en.exe from

then, there are couples of more things you need to do. I haven’t tried this myself, but here seams to be the steps you need to do:

1. drag the RemotingClasses by doing the following:

From the open fla file in flash, go to Window — > Other Panels –> Common Libraries –> Remoting
Then drag the RemotingClasses on the stage of your movie. You can delete it off the stage and it will stay in your library.

The RemotingDebugClasses is for debugging during testing. You may want to remove this from your library when you go to production to reduce the file size.

2. You need to use
import mx.remoting.Connection;
import mx.remoting.NetServices;

Instead of #include “” because it is deprecated.

Tips for using PrintingJob in flex 1.5

1. The sample from “Flex 1.0: Sample code for printing from a DataGrid” doesn’t work correctly.
That sample was written for flex 1.0. To use it in flex 1.5, Use the attached PrintDatagrid.mxml instead.

2. Can’t print out header/footer area.
Let’s say you have a DataGrid you want to print, but you also want to print out a label or a button as a header of the DataGrid. To do so, you need to do two things:
1). Put the label/button and the DataGrid into a container, like VBox or Panel; in Printjob.addPage(), you need to reference the id of that container, not the DataGrid.
2). you need to set the print area properly, for example:
you need to adjust the xMin and yMin properly to include the header area. See printextra.mxml. This sample prints a button that is outside of the Panel.

3. When the print area is larger than the screen, some of the content doesn’t print out.
This is because application is clipping its children. To avoid this problem, You can set “clipContent=’false’ ” on both the application and the box your want to print. Note, in order for this to work properly, you need to set the application’s width/height to be large enough for the area you want to print.

Let’s say you want to print a DataGrid that is 500X600, and you set
<mx:Application xmlns:mx=”” width=”100%” height=”100%” >
When the browser screen is larger than 500X600, then the print will work correctly. However, if the user resizes the screen to 400X500, and then do the print, then some portion will be clipped. To make sure the print always work correctly, you need to set the application’s width/height to be always Larger than 500X600.

4. When printing any chart, the print out always has gray background.
Charts, by default, have a transparent background with alpha = 0. They do this so they can show the background of whatever is behind them, but still catch mouse events for datatips. However, since printing doesn’t support alpha, the background is showing through as grey.
There are two ways to workaround this problem:
1). set the backgrandColor of the container that contains the chart to a color you desire.
2). explicitly set the fill of the chart like this:

<mx:ColumnChart id=”column” dataProvider=”{expenses}” >
<mx:SolidColor color=”#FFFFFF” />

Note, this approach may cause problem described in #3 above. You need to set the width and height at the app level to be big enough for your chart.