# Playing Video referenced from within a class

**URL:** <https://forum.kirupa.com/t/playing-video-referenced-from-within-a-class/318925>\
**Category:** flash\
**Created:** [February 3, 2011, 4:27pm UTC](https://forum.kirupa.com/t/playing-video-referenced-from-within-a-class/318925 "2011-02-03T16:27:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon\_davies](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@simon\_davies](https://forum.kirupa.com/u/simon_davies)\
**Post date:** [February 3, 2011, 4:27pm UTC](https://forum.kirupa.com/t/playing-video-referenced-from-within-a-class/318925/1 "2011-02-03T16:27:18Z")

</div>

I have this video button, with a class attached, All works ok but when I come to press the button I get my trace but the player does not work.

MY BUTTON is in a Container

MY FLVPlayer is in another Container

my button class is as follows:

```auto
package com.ppr.buttons{
	
		import flash.events.*;
		import flash.display.*;
		import flash.media.Video;
	
	public class lrgPlayButton extends MovieClip {
			//-- some setting/properties or variables as I know them
		private var videoContainer:MovieClip;	
			
		public function lrgPlayButton(vCont:MovieClip) {
			// constructor code
				stop();
				this.alpha=.4;
				videoContainer= vCont;
				this.buttonMode = true;
				this.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
				this.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
				this.addEventListener(MouseEvent.CLICK, buttonClick);

		}
		
		
		private function buttonClick(e:MouseEvent)
		{
			trace("Play " + videoContainer);
                        [COLOR="DarkOrange"]//-- how do i reference the flvplayer on the 
                        //--- on the stage within a container named videoContainer and flvplayer instance named _flvPlayer[/COLOR]

			[COLOR="Red"]videoContainer._flvPlayer.play();[/COLOR]
		}
		
		private function buttonOver(e:MouseEvent)
		{
			this.gotoAndStop(2);
			this.alpha=1;
		}
		
		private function buttonOut(e:MouseEvent)
		{
			this.gotoAndStop(1);
			this.alpha=.4;
		}

	}
	
}

```

on the Stage of my flash I have the following as to attach the button within a container:

```auto
var lrgPlayBtn:lrgPlayButton = new lrgPlayButton(videoScreenContainer);
		_contentCont_mc.addChild(lrgPlayBtn);
		lrgPlayBtn.y=140;
		lrgPlayBtn.x=245;

```

My flv player is in a container called: videoScreenContainer with a instance name of \_flvplayer, and this is placed on the stage.

At the moment I am passing the name of the video container into the above constructer ‘**public function lrgPlayButton(vCont:MovieClip) {.**.’ then assigning that to a variable called ‘ **videoContainer= vCont** ;’ thus…

thinking it would be '**videoContainer.\_flvPlayer.play();**'so I thought.

any ideas how I can do this?

many thanks  
Si
