[AS3.0] Error #1069: Property onBWDone not found on flash.net.NetConnection and there is no default value.解决办法

时间:2023-03-09 18:06:44
[AS3.0] Error #1069: Property onBWDone not found on flash.net.NetConnection and there is no default value.解决办法

在运用FMS录制视频时,假如出现这个错误,最直接的解决办法如下:

_netConnection.client = { onBWDone: function():void{ trace("onBWDone"); } };

不过也存在第二种解决办法:

_netConnection.client = this;

public function onBWDone(...rest):void
{
var p_bw:Number;
if (rest.length > 0){
p_bw = rest[0];
}
trace("bandwidth = " + p_bw + " Kbps.");
}

还有第三种解决办法:

_netConnection.client = new NetConnectionClient();
package
{
public class NetConnectionClient
{
public function NetConnectionClient()
{
} public function onBWCheck(...rest):Number
{
return 0;
} public function onBWDone(...rest):void
{
var p_bw:Number;
if (rest.length > 0){
p_bw = rest[0];
}
trace("bandwidth = " + p_bw + " Kbps.");
}
}
}