Package | org.osmf.net |
Class | public dynamic class NetClient |
Inheritance | NetClient Proxy Object |
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Use this class to listen for callbacks on the NetConnection and NetStream created by a NetLoader's load operation.
Assign the value of the client
property of the NetConnection or NetStream
to an instance of the NetClient class.
Then use the NetClient's addHandler()
and removeHandler()
methods to register and unregister handlers for
the NetStream callbacks.
Related API Elements
Method | Defined By | ||
---|---|---|---|
Adds a handler for the specified callback name. | NetClient | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes a handler method for the specified callback name. | NetClient | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
addHandler | () | method |
public function addHandler(name:String, handler:Function, priority:int = 0):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Adds a handler for the specified callback name.
If multiple handlers register for the same callback, the result of the callback is an array holding the results of each handler's invocation.
This example sets up handler for the onMetaData
callback.
function onMetaData(value:Object):void { trace("Got metadata."); } var stream:NetStream; var client:NetClient = (stream.client as NetClient); //assign the stream to the NetClient client.addHandler("onMetaData", onMetaData); //add the handler
Parameters
name:String — Name of callback to handle.
| |
handler:Function — Handler to add.
| |
priority:int (default = 0 )
|
removeHandler | () | method |
public function removeHandler(name:String, handler:Function):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Removes a handler method for the specified callback name.
Parameters
name:String — Name of callback for whose handler is being removed.
| |
handler:Function — Handler to remove.
|
Mon Nov 28 2011, 06:48 AM -08:00