Game Development Reference
In-Depth Information
keystroke you
d like; it defaults to the space bar. The protected
properties are all related to keeping track of the video.
'
public function CutsceneManager(width:int, height:int) : void {
setupConnection();
_video = new Video(width, height);
addChild(_video);
}
protected function setupConnection() :void {
_nc = new NetConnection();
_nc.addEventListener(NetStatusEvent.NET_STATUS,
netStatus, false, 0, true);
_nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityError, false, 0, true);
_nc.connect(null);
}
The constructor function creates a new CutsceneManager and sets
up both the NetConnection and Video objects and prepares them for
use. The NetConnection instance sets up a couple of listeners as well,
which we
'
ll look at next.
protected function netStatus(e:NetStatusEvent) {
switch (e.info.code) {
case " NetStream.Play.StreamNotFound " :
trace( " Unable to locate video: " +
_activeVideo);
break;
case " NetStream.Play.Start " :
dispatchEvent(new Event(Event.INIT));
break;
case " NetStream.Play.Stop " :
stopCutscene(Event.COMPLETE);
break;
}
}
protected function securityError(e:SecurityErrorEvent):void {
trace(e);
}
protected function asyncError(e:AsyncErrorEvent):void {
//IGNORE ASYNCHRONOUS ERRORS
}
NetStatusEvent messages are used for both NetConnection and
NetStream objects. Anytime anything happens to the connection of
Search Nedrilad ::




Custom Search