I’m new to classes.
I’ve been struggling with a videoPlayback class and a fullscreenControls subclass.
Maybe I’m approaching this wrong, but first, I create an object with the videoPlayback class.
Upon clicking the fullscreen button I’ve created it calls a method within the videoPlayback class that changes the video size and creates a new object with the fullscreenControls class that extends the videoPlayback class. I also override the method that creates a new video from the video playback class.
All of this works fine and dandy, but when I try to call methods from the fullscreenControls subclass back to videoPlayback using super.MethodName(); I get an error of an object being null.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at videoPlayback/pauseVideo()
at fullscreenControls/fsPauseVideo()
videoPlaybackClass
package {
import flash.text.TextField;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.text.TextFieldAutoSize;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
public class videoPlayback extends MovieClip {
public var nc:NetConnection;
public var ns:NetStream;
public var vid:Video;
public var fullscreenController:fullscreenControls;
public function videoPlayback() {
createVideo();
}
public function createVideo() {
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.play("videos/welcome.flv");
vid = new Video ();
ns.client = new customClient(); //creates custom client form customClient.as to watch for MetaData and Cue Points
vid.attachNetStream(ns);
addChild(vid);
}
public function restartVideo() {
ns.seek(0);
ns.resume();
}
public function pauseVideo() {
ns.pause();
}
public function resumeVideo() {
ns.resume();
}
public function minimizeVideo() {
x = 482;
y = 144;
width = 500;
height = 375;
}
public function fullscreenVideo() {
y = 0;
x = 0;
width = 1024;
height = 768;
fullscreenController = new fullscreenControls;
addChild(fullscreenController);
}
}
}
fullscreenControls Class
package {
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
//import flash.display.DisplayObjectContainer;
public class fullscreenControls extends videoPlayback {
public function fullscreenControls() {
super();
fsPause_btn.addEventListener(MouseEvent.CLICK, fsPauseVideo);
}
override public function createVideo() {
//
}
public function fsPauseVideo(event:MouseEvent):void {
super.pauseVideo();
}
}
}
Any help would be greatly appreciated.
I can find a way to do this without a subclass but I figured it would be a good idea to do it.