This project is Actionscript 2.0, Flash 8 player, Authored in Flash CS3
I’m using a class to attach a movie to a video object I’ve created (and added the proper linkage to) on the stage. Loading the video wasn’t a problem, it shows up and plays. The issue I’m having is that the movie is ignoring my pause command which is being sent from within the same class.
The code I use to create the object:
var newScaffold:Object = new VideoScaffold("assets/video/UnAlbertan.flv", 320, 240);
Class Code: (problem code in red)
class PresentationSlideshow.VideoPlayer.VideoScaffold extends MovieClip {
private var _stageWidth:Number = Stage.width;
private var _stageHeight:Number = Stage.height;
private var _ncConnection:NetConnection;
private var _nsStream:NetStream;
//private var _isPlaying:Boolean = true
public function VideoScaffold(path:String, vWidth:Number, vHeight:Number){
buildScaffold(path, vWidth, vHeight);
loadVideo(path);
}
private function buildScaffold(path:String, vWidth:Number, vHeight:Number){
// Create container for movie
var movieContainer:MovieClip = _root.createEmptyMovieClip("movieContainer", _root.getNextHighestDepth());
// Attach the video objct within the empty movie
movieContainer.attachMovie("theVideo", "videoContainer", this.getNextHighestDepth());
// Set the container so the video is in the exact middle of the screen
movieContainer.videoContainer._width = vWidth;
movieContainer.videoContainer._height = vHeight;
movieContainer._x = (_stageWidth/2) - (vWidth/2);
movieContainer._y = (_stageHeight/2) - (vHeight/2);
movieContainer.attachMovie("videoControls", "videoControls", movieContainer.getNextHighestDepth());
movieContainer.videoControls._x = (vWidth/2)-225;
movieContainer.videoControls._y = vHeight + 40;
}
public function buildControls(vWidth:Number, vHeight:Number){
// Place the controls under the movie
}
public function loadVideo(path:String):Void{
_ncConnection = new NetConnection();
_ncConnection.connect(null);
_nsStream = new NetStream(_ncConnection);
_root.movieContainer.videoContainer.vMovie.attachVideo(_nsStream);
_nsStream.play(path);
//trace(_nsStream);
// Add functionality to the controls
[COLOR="Red"] _root.movieContainer.videoControls.playPauseButton.onRelease = function():Void{
_nsStream.pause();
}[/COLOR]
}
}
Any help would be much appreciated.
–thanks