Я новичок в flex.I создал динамический веб-проект. Запустить его. Это доступно на http://localhost:5080/myApp. Теперь я хочу создать соединение с этим приложением, но я получил NetConnection.Connect.Rejected. Это мой код:
import mx.core.UIComponent;
import mx.events.FlexEvent;
private var connection:NetConnection;
private var inStream:NetStream;
private var outStream:NetStream;
private var camera:Camera;
private var microphone:Microphone;
private var inVideo:Video;
private var outVideo:Video;
private var inVideoWrapper:UIComponent;
private var outVideoWrapper:UIComponent;
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
connection = new NetConnection();
connection.connect("rtmp://localhost/myApp");
connection.addEventListener(NetStatusEvent.NET_STATUS, onConnected);
}
private function onConnected(event:NetStatusEvent):void
{
if(event.info.code == "NetConnection.Connect.Success")
{
setupVideo();
}
}
private function setupVideo():void
{
camera = Camera.getCamera();
microphone = Microphone.getMicrophone();
outStream = new NetStream(connection);
outStream.attachCamera(camera);
outStream.attachAudio(microphone);
outStream.publish("Radislav");
outVideo = new Video();
outVideo.attachCamera(camera);
inStream = new NetStream(connection);
inStream.play("Radislav");
inVideo = new Video();
inVideo.attachNetStream(inStream);
outVideoWrapper = new UIComponent;
outVideoWrapper.addChild(outVideo);
addElement(outVideoWrapper);
inVideoWrapper = new UIComponent;
inVideoWrapper.addChild(inVideo);
addElement(inVideoWrapper);
inVideoWrapper.move(400,0);
}