PDA

View Full Version : NetStatusEvent doesnt fire some of the events



regbolD
July 7th, 2009, 11:36 AM
if I say:
netStream.pause();
netStream.resume();
netStream.togglePause();
netStream.close();

these events dont seem to be fired...


_netStream.addEventListener(NetStatusEvent.NET_STA TUS, onNetStatus);

private function onNetStatus(evt:NetStatusEvent):void
{
trace("netStream_onNetStatus: " + evt.info.code, evt.target);
switch(evt.info.code)
{
case "NetConnection.Connect.Closed":
//do something
break;
case "NetStream.Pause.Notify":
//do something
break;
case "NetStream.Unpause.Notify":
//do something
break;
}
}

not that I especially need those but how can I rely on netStreamEvents if I dont know which is or isnt going to be fired....

creatify
July 7th, 2009, 10:38 PM
I'm taking a shot in the dark here - but did you try adding the NetStatusEvent listener to the NetConnection as well, not sure if the NetConnection and NetStream fire different status events - that's just from a quick peek at the example here: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/NetStatusEvent.html

regbolD
July 8th, 2009, 04:57 AM
I actaully use adobe example:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html#includeExamplesSummary

In this example, the code that creates the Video and NetStream objects and calls the Video.attachNetStream() and NetStream.play() methods is placed in a handler function. The handler is called only if the attempt to connect to the NetConnection object is successful; that is, when the netStatus event returns an info object with a code property that indicates success. It is recommended that you wait for a successful connection before you call NetStream.play().

.ral:cr
July 8th, 2009, 06:14 AM
don't you get anything on the trace?

regbolD
July 8th, 2009, 07:42 AM
I do get these: NetConnection.Connect.Success, NetStream.Buffer.Full, NetStream.Buffer.Empty, NetStream.Play.Stop, NetStream.Play.Start which are probably enough :D