Game Development Reference
In-Depth Information
assume that the video is terminated prematurely when it is called.
This way you will be able to differentiate from the outside the class
whether the video was able to finish playing or it was skipped. In
addition to dispatching a message about the status of the video, the
stopCutscene method performs two other important functions. One
is to close out the NetStream object (whether the video is still com-
ing from it) and the other is to clear the video. Without the latter
function, the last frame of the video would stay in the Video object,
covering up everything behind it.
That completes the CutsceneManager class. Since we reviewed
it in pieces, here is the entire script with all the methods in
context.
package {
import flash.display.Sprite;
import flash.events.AsyncErrorEvent;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.ui.Keyboard;
public class CutsceneManager extends Sprite{
public var skipKey:uint = Keyboard.SPACE;
protected var _nc:NetConnection;
protected var _stream:NetStream;
protected var _video:Video;
protected var _activeVideo:String;
public function CutsceneManager(width:int, height:
int) : void {
setupConnection();
_video = new Video(width, height);
addChild(_video);
}
public function playCutscene(url:String) : void {
_activeVideo = url;
_stream = new NetStream(_nc);
_stream.addEventListener(NetStatusEvent.
NET_STATUS, netStatus, false, 0, true);
Search Nedrilad ::




Custom Search