Game Development Reference
In-Depth Information
_stream.addEventListener(AsyncErrorEvent.
ASYNC_ERROR, asyncError, false, 0, true);
_video.attachNetStream(_stream);
_stream.play(url);
if (stage) stage.addEventListener(KeyboardEvent.
KEY_DOWN, skipCutscene, false, 0, true);
}
public function stopCutscene(eventType:String = Event.
CANCEL) : void {
_stream.close();
_video.clear();
dispatchEvent(new Event(eventType));
if (stage) stage.removeEventListener(KeyboardEvent.
KEY_DOWN, skipCutscene);
}
public function get activeVideo():String {
return _activeVideo;
}
protected function skipCutscene(e:KeyboardEvent) {
if (e.keyCode == skipKey) stopCutscene();
}
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);
}
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;
"
}
}
Search Nedrilad ::




Custom Search