我在我的班级中创建了add_to_stage eventlistener,但是flash正在给出错误 ... \ RTMP_test.as,第28行,第8列1120:访问未定义的属性阶段。
public function RTMP_test (streamID:String, videoURL:String):void
{
sID = streamID;
vURL = videoURL;
if (stage)
{
init_RTMP();
}
else
{
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
}
private function onAddedToStage():void
{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
init_RTMP();
}
编辑:当我输入“extends MovieClip”时,我收到了另一个错误。
这是我的init_RTMP功能:
private function init_RTMP():void
{
/*
streamID = "mp4:myVideo";
videoURL = "rtmp://fms.xstream.dk/*********.mp4";
*/
vid = new Video(); //typo! was "vid = new video();"
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onConnectionStatus);
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
nc.client = { onBWDone: function():void{} };
nc.connect(vURL);
}
好的,我把“扩展MovieClip”放到了课堂上并纠正了一些错误。我没有发现任何错误。