Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 270

Programming actionscript 3.0
Table of Contents

Advertisement

public class VideoExample extends Sprite
{
private var videoUrl:String = "Video.flv";
private var connection:NetConnection;
private var stream:NetStream;
public function VideoExample()
{
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityErrorHandler);
connection.connect(null);
}
private function netStatusHandler(event:NetStatusEvent):void
{
if (event.info.level = "error")
{
trace("Video stream failed")
}
else
{
connectStream();
}
}
private function securityErrorHandler(event:SecurityErrorEvent):void
{
trace("securityErrorHandler: " + event);
}
private function connectStream():void
{
var stream:NetStream = new NetStream(connection);
var video:Video = new Video();
video.attachNetStream(stream);
stream.play(videoUrl);
addChild(video);
}
}
}
270
Handling Errors

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents