Return to Snippet

Revision: 13062
at April 8, 2009 04:10 by creativelifeform


Updated Code
var vc:NetConnection = new NetConnection();
vc.connect(null);
var vs:NetStream = new NetStream(vc);
vs.addEventListener(NetStatusEvent.NET_STATUS ,onStatusEvent);

function onStatusEvent(stat:Object):void {
	
	trace(stat.info.code);
	
}

var meta:Object = new Object();
meta.onMetaData = function(meta:Object){
	
	trace(meta.duration);
	
};

vs.client = meta;

var video:Video = new Video(stage.stageWidth, stage.stageHeight);

addChild(video);

video.attachNetStream(vs);

vs.play("flv/myFLV.flv");

//pauseButton is a movieclip in the library that is exported for actionscript with the class name pauseButton
var PauseButton:pauseButton = new pauseButton();

PauseButton.y = stage.stageHeight - PauseButton.height/2;
PauseButton.x = PauseButton.width/2;

PauseButton.addEventListener(MouseEvent.CLICK , PausePlayback);
PauseButton.useHandCursor = true;

function CreatePlay() {
	this.addChild(PauseButton);
}

function PausePlayback(e:Event):void {
	
	vs.pause();

}

CreatePlay();

Revision: 13061
at April 7, 2009 09:47 by creativelifeform


Initial Code
var vc:NetConnection = new NetConnection();
vc.connect(null);
var vs:NetStream = new NetStream(vc);
vs.addEventListener(NetStatusEvent.NET_STATUS ,onStatusEvent);

function onStatusEvent(stat:Object):void {
	
	trace(stat.info.code);
	
}

var meta:Object = new Object();
meta.onMetaData = function(meta:Object){
	
	trace(meta.duration);
	
};

vs.client = meta;

var video:Video = new Video(stage.stageWidth, stage.stageHeight);

addChild(video);

video.attachNetStream(vs);

vs.play("flv/broadcast1.flv");

//pauseButton is a movieclip in the library that is exported for actionscript with the class name pauseButton
var PauseButton:pauseButton = new pauseButton();

PauseButton.y = stage.stageHeight - PauseButton.height/2;
PauseButton.x = PauseButton.width/2;

PauseButton.addEventListener(MouseEvent.CLICK , PausePlayback);
PauseButton.useHandCursor = true;

function CreatePlay() {
	this.addChild(PauseButton);
}

function PausePlayback(e:Event):void {
	
	vs.pause();

}

CreatePlay();

Initial URL

                                

Initial Description
Also see "Accessing Library elements"

Initial Title
Dynamically Creating / Loading FLV

Initial Tags

                                

Initial Language
ActionScript 3