Video scrubber bar loses functionality AFTER first use?

I have set up a test page to demonstrate this problem HERE. I’ve posted this in the forums at actionscript.org but no one had heard of this problem before so I wasn’t able to get any help.

There are three buttons in this test page. The first two each load a previously made swf file that includes a custom video player, which plays an flv. The third just loads a static swf file, which was done as a control for testing purposes. I’ve built my video player from the tutorial on [URL=“http://www.gotoAndLearn.com”]gotoAndLearn.com.

So the issue is: when you click on either of the movie buttons, (movie1 or movie2), The player loads fine and video plays fine and the scrubber bar works as it is supposed to. However, if you click the other movie button and play that video, the scrubber bar gets all messed up and doesn’t respond properly. Worse, when you go back to the previous video whose scrubber bar was working properly, well, that scrubber bar will also be messed up and won’t respond as it did previously. The videos all play fine, and the play and pause buttons work fine. But the scrubber bar gets toasted after its first use. Each of these swfs (movie1, movie2 and movie3) are all being loaded into the same emptyMovieClip on the stage at the same level.

i know the problem is that the netStream or scrubber bar function or something is being left in the memory/cache still playing when the user clicks on a different video, which is what screws up the video scrubber bar functionality because it’s trying to keep track of a netStream that no longer exists once a user clicks on a different movie. But I can’t figure out how to clear that out and refresh the scrubber bar function.

I’ve tried, clear();, unloadMovie();, delete scrubber function, System.Clipboard(); and a few other things but to no avail. In my site where I plan to use this, I will be loading individual swfs that will contain both static images as well as swfs that contain the movie player to play videos. And these will be called onto the main stage via an xml call. So I’m no even sure how I could set up an array to keep track of which movies have already played (if I even knew how to set up arrays to begin with!!!)

I’ve searched around and have not found a way to clear a user’s computer cache from within the Flash movie itself. So far I’ve only found that clearing the cache can be done from outside the flash movie in the HTML code, but that way won’t work since it would reload the entire movie and completely reset everything, frustrating the user.

Here is the code the main test movie:
[COLOR=Red]
var mcLoader:MovieClipLoader = new MovieClipLoader();

movie1.onRelease = function() {
mcLoader.loadClip(“Golf.swf”, yetAnotherClip)
// trace(mcLoader)
}

movie2.onRelease = function() {
mcLoader.loadClip(“Golf2.swf”, yetAnotherClip)
}

movie3.onRelease = function() {
mcLoader.loadClip(“thisTest.swf”, yetAnotherClip)
}

[/COLOR][FONT=Arial][SIZE=2] Here is the code from the first video swf being called in (the code is exactly the same on the second except for the flv it calls): (Also, I do not have the “Pause” button wired completely yet, I know that)
[/SIZE][/FONT][FONT=Arial][SIZE=2][COLOR=Red]

var _mcPlayButton:MovieClip;
var _mcPauseButton:MovieClip;
var _mcPauseDbutton:MovieClip;
var _mcStopButton:MovieClip;
var _tStatus:TextField;

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

myVideo.attachVideo(ns);

/////////////VIDEO CONTROL BUTTIONS//////////

function startOver () {
_mcPlayButton.enabled = true;
_mcPauseButton.enabled = false;
}

_mcPauseDbutton._visible = false;
_mcPauseButton._visible = true;

_mcPauseButton.onRollOver = function() {
this.gotoAndStop(“over”);
}

_mcPauseButton.onReleaseOutside =_mcPauseButton.onRollOut = function() {
this.gotoAndStop(“off”);
}

_mcPauseButton.onRelease = function() {
this._visible = false
_mcPauseDbutton._visible = true
ns.pause();
_mcPlayButton.enabled = true;
_mcPlayButton._alpha = 100;
_mcPlayButton.gotoAndStop(“off”);
}

_mcPauseDbutton.onRelease = function() {
this._visible = false;
this.enabled = false;
_mcPauseButton._visible = true;
_mcPlayButton.enabled = false;
_mcPlayButton._alpha = 50;
ns.pause();
// _mcPlayButton.gotoAndStop(“off”);

}

_mcPauseDbutton.onRollOver = function() {
if(this._visible = true) {
this.gotoAndStop(“over”)
}
}

_mcPauseDbutton.onRollOut = _mcPauseDbutton.onReleaseOutside = function() {
if(this._visible = true) {
this.gotoAndStop(“paused”)
}
}

_mcPlayButton.onRollOver = function() {
this.gotoAndStop(“over”);
}

_mcPlayButton.onRollOut = _mcPlayButton.onReleaseOutside = function() {
this.gotoAndStop(“off”);
}

_mcPlayButton.onRelease = function() {
ns.play(“http://www.olivestreetproductions.com/motionMedia/videos/Golf_Park.flv”)
delete startOver();
_mcPauseDbutton._visible = false;
_mcPauseButton._visible = true
_mcPauseButton.enabled = true
_mcPlayButton.enabled = false;
_mcPlayButton._alpha = 50;
}

_mcStopButton.onRollOver = function() {
this.gotoAndStop(“over”);
}

_mcStopButton.onRollOut = _mcStopButton.onReleaseOutside = function() {
this.gotoAndStop(“off”);
}

_mcStopButton.onRelease = function() {
ns.close();
myVideo.clear();
_mcPlayButton.enabled = true;
_mcPlayButton._alpha = 100;
_mcPlayButton.gotoAndStop(“off”);
_mcPauseButton.enabled = false;
startOver();
}

/////////////END VIDEO CONTROL BUTTONS/////////////

////////////SCRUBBER BAR/LOADER BAR/////////////////////////

var videoInterval = setInterval(videoStatus, 100);
var amountLoaded:Number;
var duration:Number;
loader.loaderBar._width = 0;

ns[“onMetaData”] = function(obj) {
duration = obj.duration;
}

function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loaderBar._width = amountLoaded * 100;
loader.scrubber._x = ns.time / duration * 100;
}

var scrubInterval;

loader.scrubber.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubThis, 10);
startDrag(this, false, 0, this._y, 99, this._y)
}

loader.scrubber.onRelease = loader.scrubber.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus, 100);
this.stopDrag();
}

function scrubThis() {
ns.seek(Math.floor((loader.scrubber._x/99) * duration));
}[/COLOR][/SIZE][/FONT][FONT=Arial][SIZE=2]

///////////////////////////////////////////////////////////[/SIZE][/FONT]
[URL=“http://www.actionscript.org/forums/editpost.php3?do=editpost&p=675022”]