onBWDone problem Flash Media Server with AS3

February 19th, 2008

I ran into a small problem today while testing FMS 3, and had some problems finding the solution. I eventually found it and would like to share it with you.if you get the error:

ReferenceError: Error #1069: Property onBWDone not found on StreamTest and there is no default value.

Make sure that you map your NetConnection.client to a client class or the class you are working from. Then create the method onBWDone in the target Class. :

1
2
3
4
5
6
7
8
9
10
11
12
13
private function setConnection():void
 
{
 nc = new NetConnection();
 nc.client = this;
 nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
 nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
 nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
 nc.connect(appURL);
}
 
public function onBWDone():void{
}

 Why is this happening?
Well if you look into the VOD application on the FMS server you will see that the application performs a BandWidth check and invokes this function on the client when it is done. You can measure the bandwidth speed in order to select a proper stream (assuming you have encoded multiple bitrates of one video). How to use this?
Take a look here.