Set the NetStream object's client property to this

By setting the client property to this, Flash Player looks in the current scope for onMetaData() and onCuePoint() methods. You can see this in the following example:

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);
ns.client = this;
ns.play("video.flv");

var vid:Video = new Video();
vid.attachNetStream(ns);
addChild(vid);

If the onMetaData or onCuePoint callback handlers are called and no methods exist to handle the callback, no errors are generated. To handle these callback handlers, create an onMetaData() and onCuePoint() method in your code, as seen in the following snippet:

function onMetaData(infoObject:Object):void
{
    trace("metadata");
}
function onCuePoint(infoObject:Object):void
{
    trace("cue point");
}

Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000265.html