Using NetStream.onStatus

Usage
my_ns.onStatus = function(infoObject:Object) : Void{
// Your code here
}
Parameters
infoObject A parameter defined according to the status or error message. For more information about this parameter, see "Description," below.
Returns
Nothing.
Description
Event handler; invoked every time a status change or error is posted for the NetStream object. If you want to respond to this event handler, you must create a function to process the information object.
The information object has a code property containing a string that describes the result of the onStatus handler, and a level property containing a string that is either status or error.
In addition to this onStatus handler, Flash also provides a "super" function called System.onStatus. If onStatus is invoked for a particular object and there is no function assigned to respond to it, Flash processes a function assigned to System.onStatus if it exists.
The following events notify you when certain NetStream activities occur.
- NetStream.Buffer.Empty: Data is not being received quickly enough to fill the buffer. Data flow will be interrupted until the buffer refills, at which time a NetStream.Buffer.Full message will be sent and the stream will begin playing again.
**************************************************************
- NetStream.Buffer.Full: The buffer is full and the stream will begin playing.
- NetStream.Play.Start: Playback has started.
- NetStream.Play.Stop: Playback has stopped.
- NetStream.Play.StreamNotFound: The FLV passed to the play() method can't be found.
**************************************************************
Example
The following example displays data about the stream in the Output panel:
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
//Create a movieclip to store the audio of our netstream
this.createEmptyMovieClip("snd", this.getNextHighestDepth());
//Attach the netstream audio to the newly created symbol
snd.attachAudio(ns);
//we can now alter the volume of the netstream by setting the sound level of "audio"
var audio:Sound = new Sound(snd);
audio.setVolume(0); // muted sound
stream_ns.play("video1.flv");
stream_ns.onStatus = function(infoObject:Object) {
trace("NetStream.onStatus called: ("+getTimer()+" ms)");
for (var prop in infoObject) {
trace("\t"+prop+":\t"+infoObject[prop]);
}
trace("");
};
See also

Camera.onStatus, LocalConnection.onStatus, Microphone.onStatus, System.onStatus, SharedObject.onStatus

Nhận xét

Bài đăng phổ biến từ blog này

Ký tự viết tắt trong chat & email

Category 5 / 5E & Cat 6 Cabling Tutorial and FAQ's

Ubuntu LAMP Server