Bluemini.comBluemini.com

Flash video with FMS 2

posted: 16 Jan 2008

I've recently started playing with Flex with particular interest in video. I've studied a lot tutorials all over the place but when I tried to use Actionscipt's NetConnection and NetStream functions rather than the simpler VideoDisplay tag I kept encountering connection errors when trying to connect to a Flash Media Server. I could find nothing on Adobe (that's not to say it's not there, but I just couldn't find it) but eventually, after much searching found a blog post about the default encoding. It appears that Actionscript 3 has introduced a number of new features, one of which is a new Action Message Format (AMF3). It would appear that AMF3, the default format chosen by Actionscript3, is incompatible with Flash Media Server 2 (FMS2) and as such, connections to FMS2 fail.

The answer, when you know it, is simply to set the defaultObjectEncoding property of the NetConnection object to use AMF0, easy when you know how!

NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0

For other interesting quirks when using Flex 2 and FMS 2, check out this very useful page:

flash-communications.net

(I'll look for the other page I found which was also very useful...)

keywords: