After working with the NetStream class for quite some time it has always striken me how badly the "client" approach is.
Default behaviournetStream.client = {onCuePoint:myCuePointCallback}; function myCuePointCallback ( point:Object ) : void { }
Basicly to retrive a cue point we have to assign the client property with a object populated with a needed set of callback functions, that in the end will be triggered by the NetConnection class. You rarely see this callback mechanism in as3 and it can easly get a bit confusing, mainly beacuse you need to remember the callback function names.
So I made a specific client class for NetStream which extends the Proxy util and converts the callbacks into actual events with EventDispatcher. It works like this.
Usage// create a instance client = new NetStreamClient(); // assign the client netStream.client = client; // then just add listeners to the client client.addEventListener( NetStreamClientEvent.CUE_POINT, client_cuePointHandler ); client.addEventListener( NetStreamClientEvent.META_DATA, client_metaDataHandler ); // an example of the handler function function client_cuePointHandler ( info:Object ) : void { trace( [info.name, info.time, info.cuetype] ); }
The NetStreamClient covers the most used callbacks (such as metadata, play status), and the callbacks it cannot identify gets labeled as a Unknown call.
Try it out and just shout if you have any comments! Download it here here, or view the NetStreamClient class here.