How to make VideoDisplay component work with Macromedia Flash Communication/Media Server?

If you already know about VideoDisplay component, please skip next two paragraphs to see the solution.
VideoDisplay component in Macromedia Flex 2.0 would be replacement of MediaDisplay component in previous versions of Flex. Unlike MediaDisplay component, it doesn't have any UI controls, it's a face-less component. It provides you API to control the video playback. So you can build user-interface, controls around it and skin it according to your choice. This was quite difficult with MediaDisplay.
Macromedia Flex 2.0 is still in alpha-phase and if you strongly feel the need of controls, please give us your feedback. We can probably ship it with some default controls.
Anyways, let's talk about the issue which some people faced while using VideoDisplay with RTMP URLs.
Problem: VideoDisplay component doesn't play video from a RTMP URL?
For example, following code would compile but won't work as expected i.e. it won't play video when application is run.






Solution: VideoDisplay is based on Peldi's FLVPlayer. Like FLVPlayer, it requires a server-side ActionScript file(main.asc) to be placed inside corresponding FlashCom application directory on server.
If you are missing main.asc on server-side, VideoDisplay won't be able to play videos from a RTMP URL.
You need to place main.asc inside "scripts" folder under your FlashCom application directory. I am taking above code as reference to explain where you can place main.asc. You can see the directory structure of a FlashCom application in following image:
directory structure of videodisplay flashcomm application.
Description about directories shown above:

I have uploaded the main.asc on my server so that you can download it from here itself. You can also get the same file from Peldi's blog, but you need to download the entire FLVPlayer.zip to get main.asc.
Download main.asc