# \[flash8\] Issue playing/pausing video from classes

**URL:** <https://forum.kirupa.com/t/flash8-issue-playing-pausing-video-from-classes/246254>\
**Category:** flash\
**Created:** [December 9, 2007, 12:25am UTC](https://forum.kirupa.com/t/flash8-issue-playing-pausing-video-from-classes/246254 "2007-12-09T00:25:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ff6600](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ff6600/32/2792_2.png) [@ff6600](https://forum.kirupa.com/u/ff6600)\
**Post date:** [December 9, 2007, 12:25am UTC](https://forum.kirupa.com/t/flash8-issue-playing-pausing-video-from-classes/246254/1 "2007-12-09T00:25:39Z")

</div>

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:

```auto

var newScaffold:Object = new VideoScaffold("assets/video/UnAlbertan.flv", 320, 240);

```

Class Code: (problem code in red)

```auto

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
