a good example of that

http://flash-communications.net/technotes/fms2/flex2FMS/index.html


Regards

On 10/6/06, eccentricwade <[EMAIL PROTECTED]> wrote:

I am trying to connect to an RTMP stream from the Flash Media server
in Flex 2. I have yet to be able to pull this off. Following the api I
have the following class in the components directory and below that
the mxml. This is the error that I receive. Any ideas on how to make
this work would be greatly appreciated.

Video Example!
netStatusHandler
connectStream
netStatusHandler
Unable to locate video: rtmp://10.3.0.104/iscam1

-- Wade

package components {
import flash.display.Sprite;
import flash.events.*;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;

public class VideoExample extends Sprite {
private var videoURL:String = "rtmp://10.3.0.104/iscam1";
private var connection:NetConnection;
private var stream:NetStream;

public function VideoExample() {
trace("Video Example!");
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);

connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityErrorHandler);
connection.connect(null);
}

private function netStatusHandler(event:NetStatusEvent):void {
trace("netStatusHandler");
switch (event.info.code) {
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace("Unable to locate video: " + videoURL);
break;
}
}

private function connectStream():void {
trace("connectStream");
var stream:NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
asyncErrorHandler);
var video:Video = new Video();
video.attachNetStream(stream);
stream.play(videoURL);
addChild(video);
}

private function
securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}

private function asyncErrorHandler(event:AsyncErrorEvent):void {
// ignore AsyncErrorEvent events.
}
}
}

AND THE MXML

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:T8="components.*"
layout="vertical" horizontalAlign="left">

<T8:VideoExample />

</mx:Application>




--
----------------------------
Igor Costa
www.igorcosta.com __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to