home *** CD-ROM | disk | FTP | other *** search
- this.numFIS = new Array(755,725,728,2);
- this.baseName = "Avid Xpress Studio_";
- this.numSlices = 4;
- this.numFPS = 15;
- smartLoader_c = function()
- {
- };
- smartLoader_c.prototype = new Object();
- Object.registerClass("smartLoader_c",smartLoader_c);
- smartLoader_c.prototype.playNextMovie = function()
- {
- if(this.playBuff.length > 0)
- {
- this.waitingToPlay = false;
- this.lastPlayObj = this.playObj;
- this.playObj = this.playBuff.shift();
- if(this.playObj.sliceNum == this.numSlices - 1)
- {
- if(this.playObj.movieClip._totalframes <= this.targetPlayFrame)
- {
- this.targetPlayFrame = this.playObj.movieClip._totalframes - 1;
- }
- }
- if(this.playObj.movieClip._framesloaded >= this.targetPlayFrame)
- {
- if(this.lastPlayObj != undefined)
- {
- this.loadBuff.push(this.lastPlayObj);
- }
- this.lastplayObj.movieClip._visible = false;
- this.playObj.movieClip._visible = true;
- this.parentThis.smMovieClip._alpha = 100;
- if(this.hasSetPosition == false)
- {
- this.xPos = - this.parentThis.smMovieClip._width / 2;
- this.yPos = - this.parentThis.smMovieClip._height / 2;
- this.hasSetPosition = true;
- }
- this.playObj.movieClip.gotoAndStop(this.targetPlayFrame);
- this.playObj.movieClip._x = this.xPos;
- this.playObj.movieClip._y = this.yPos;
- if(this.playing)
- {
- this.playObj.movieClip.play();
- }
- this.targetPlayFrame = 2;
- }
- else if(this.playObj.movieClip._totalframes > this.targetPlayFrame)
- {
- this.playBuff.push(this.playObj);
- this.playObj = this.lastPlayObj;
- this.waitingToPlay = true;
- }
- else
- {
- this.targetPlayFrame = this.targetPlayFrame - this.playObj.movieClip._totalframes + 2;
- this.loadBuff.push(this.playObj);
- this.playObj = this.lastPlayObj;
- this.waitingToPlay = true;
- }
- }
- else if(this.playObj.sliceNum == this.numSlices - 1)
- {
- if(this.playObj.movieClip._currentframe == 2)
- {
- this.waitingToPlay = true;
- }
- else
- {
- this.playObj.movieClip.gotoAndStop(this.playObj.movieClip._totalframes - 1);
- this.waitingToPlay = false;
- }
- }
- else
- {
- this.waitingToPlay = true;
- }
- };
- smartLoader_c.prototype.preloadMovie = function()
- {
- if(!this.settingLoadParameters)
- {
- if(!this.loading)
- {
- if(this.loadBuff.length > 0 && this.sliceToLoad < this.numSlices)
- {
- this.loading = true;
- this.parentThis.smMovieClip.loadMovieActive = false;
- this.lastLoadReady = false;
- this.loadedName = this.baseName + this.sliceToLoad + ".swf";
- this.loadObj = this.loadBuff.pop();
- this.movieName = this.loadObj.movieClip._name;
- this.movieDepth = this.loadObj.movieClip.getDepth();
- this.loadObj.movieClip.removeMovieClip();
- this.parentThis.smMovieClip.createEmptyMovieClip(this.movieName,this.movieDepth);
- delete this.loadObj.movieClip;
- this.loadObj.movieClip = this.parentThis.smMovieClip[this.movieName];
- this.loadObj.movieClip.loadMovie(this.loadedName);
- this.loadObj.sliceNum = this.sliceToLoad;
- this.startloadtime = getTimer();
- this.sliceToLoad = this.sliceToLoad + 1;
- }
- }
- if(this.loadObj.movieClip._framesloaded > 1 && this.parentThis.smMovieClip.loadMovieActive)
- {
- if(this.loadObj.movieClip.getBytesLoaded() != 0)
- {
- if(this.loadObj.movieClip.getBytesLoaded() < this.loadObj.movieClip.getBytesTotal())
- {
- if(this.loadObj.movieClip._currentframe > 0)
- {
- if(this.loadObj.movieClip.getBytesLoaded() > 32768)
- {
- var timeTotal = this.loadObj.movieClip._totalframes / this.fps;
- var bytesPerSec = this.loadObj.movieClip.getBytesLoaded() * 1000 / (getTimer() - this.startloadtime);
- var timeToFinish = (this.loadObj.movieClip.getBytesTotal() - this.loadObj.movieClip.getBytesLoaded()) / bytesPerSec + 5;
- if(timeTotal >= timeToFinish)
- {
- if(this.lastLoadReady == false)
- {
- if(this.skipFrames < 0)
- {
- this.targetPlayFrame = this.loadObj.movieClip._totalframes + this.skipFrames - 1;
- if(this.targetPlayFrame > 1)
- {
- this.skipFrames = 0;
- this.loadObj.movieClip._visible = false;
- this.playBuff.push(this.loadObj);
- this.lastLoadReady = true;
- }
- }
- else
- {
- this.playBuff.push(this.loadObj);
- this.lastLoadReady = true;
- }
- }
- }
- }
- }
- }
- else
- {
- if(this.lastLoadReady == false)
- {
- if(this.skipFrames < 0)
- {
- this.targetPlayFrame = this.loadObj.movieClip._totalframes + this.skipFrames;
- if(this.targetPlayFrame > 1)
- {
- this.skipFrames = 0;
- this.playBuff.push(this.loadObj);
- }
- else
- {
- this.sliceToLoad = this.loadObj.sliceNum - 1;
- if(this.sliceToLoad < 0)
- {
- this.sliceToLoad = 0;
- this.skipFrames = 0;
- this.targetPlayFrame = 2;
- this.playBuff.push(this.loadObj);
- }
- else
- {
- this.skipFrames = this.targetPlayFrame - 2;
- this.loadBuff.push(this.loadObj);
- }
- }
- }
- else
- {
- this.loadObj.movieClip._visible = false;
- this.playBuff.push(this.loadObj);
- }
- this.lastLoadReady = true;
- }
- this.loading = false;
- }
- }
- }
- if(this.waitingToPlay && this.playBuff.length > 0)
- {
- this.playNextMovie();
- }
- }
- };
- smartLoader_c.prototype.gotoStart = function()
- {
- this.settingLoadParameters = true;
- if(this.playObj.sliceNum == 0)
- {
- this.playObj.movieClip.stop();
- if(this.playing)
- {
- this.targetPlayFrame = 2;
- this.playObj.movieClip.gotoAndPlay(2);
- }
- else
- {
- this.targetPlayFrame = 2;
- this.playObj.movieClip.gotoAndStop(2);
- }
- }
- else
- {
- if(this.playObj != undefined)
- {
- this.playObj.movieClip.stop();
- this.loadBuff.push(this.playObj);
- while(this.playBuff.length > 0)
- {
- this.playObj = this.playBuff.shift();
- this.loadBuff.push(this.playObj);
- }
- this.playObj = undefined;
- }
- this.waitingToPlay = true;
- this.sliceToLoad = 0;
- if(this.loading)
- {
- this.loadBuff.push(this.loadObj);
- this.loading = false;
- }
- this.targetPlayFrame = 2;
- }
- this.settingLoadParameters = false;
- };
- smartLoader_c.prototype.gotoEnd = function()
- {
- this.settingLoadParameters = true;
- if(this.playObj.sliceNum == this.numSlices - 1)
- {
- this.targetPlayFrame = 2;
- this.playObj.movieClip.gotoAndStop(this.playObj.movieClip._totalframes - 1);
- }
- else
- {
- if(this.playObj != undefined)
- {
- this.playObj.movieClip.stop();
- while(this.playBuff.length > 0)
- {
- nextObj = this.playBuff.shift();
- if(nextObj.sliceNum == this.numSlices - 1)
- {
- this.playBuff.push(nextObj);
- this.targetPlayFrame = nextObj.movieClip._totalframes - 1;
- this.sliceToLoad = this.numSlices;
- break;
- }
- this.loadBuff.push(nextObj);
- }
- }
- this.waitingToPlay = true;
- if(this.playBuff.length == 0)
- {
- this.sliceToLoad = this.numSlices - 1;
- if(this.loading)
- {
- if(this.loadObj.sliceNum != this.numSlices - 1)
- {
- this.loadBuff.push(this.loadObj);
- this.loading = false;
- }
- }
- this.targetPlayFrame = 99999;
- }
- }
- this.settingLoadParameters = false;
- };
- smartLoader_c.prototype.fastForward = function(numFrames)
- {
- this.settingLoadParameters = true;
- if(this.playObj != undefined)
- {
- this.playObj.movieClip.stop();
- if(this.playObj.movieClip._totalframes - numFrames > this.playObj.movieClip._currentframe)
- {
- frameNumber = this.playObj.movieClip._currentframe + numFrames;
- this.targetPlayFrame = 2;
- if(this.playing)
- {
- this.playObj.movieClip.gotoAndPlay(this.playObj.movieClip._currentframe + numFrames);
- }
- else
- {
- this.playObj.movieClip.gotoAndStop(this.playObj.movieClip._currentframe + numFrames);
- }
- }
- else if(this.playObj.sliceNum == this.numSlices - 1)
- {
- frameNumber = this.playObj.movieClip._totalframes - 1;
- this.targetPlayFrame = 2;
- this.playObj.movieClip.gotoAndStop(this.playObj.movieClip._totalframes - 1);
- }
- else
- {
- this.targetPlayFrame = this.playObj.movieClip._currentframe + numFrames - this.playObj.movieClip._totalframes + 2;
- this.playNextMovie();
- }
- }
- else
- {
- this.targetPlayFrame = numFrames + 1;
- }
- this.settingLoadParameters = false;
- };
- smartLoader_c.prototype.moviePlay = function()
- {
- this.playing = true;
- this.playObj.movieClip.play();
- };
- smartLoader_c.prototype.movieStop = function()
- {
- this.playing = false;
- this.playObj.movieClip.stop();
- };
- smartLoader_c.prototype.getTotalFrames = function()
- {
- return this.totalFrames;
- };
- smartLoader_c.prototype.getCurrentFrame = function()
- {
- var cFrame;
- cFrame = this.playObj.movieClip._currentframe - 1;
- cFrame += this.prevFrames[this.playObj.sliceNum];
- if(cFrame < 0)
- {
- cFrame = 0;
- }
- return cFrame;
- };
- smartLoader_c.prototype.rewind = function(numFrames)
- {
- this.settingLoadParameters = true;
- if(this.playObj != undefined)
- {
- this.playObj.movieClip.stop();
- if(this.playObj.movieClip._currentframe > numFrames + 1)
- {
- frameNumber = this.playObj.movieClip._currentframe - numFrames;
- if(this.playing)
- {
- this.playObj.movieClip.gotoAndPlay(this.playObj.movieClip._currentframe - numFrames);
- }
- else
- {
- this.playObj.movieClip.gotoAndStop(this.playObj.movieClip._currentframe - numFrames);
- }
- }
- else if(this.playObj.sliceNum == 0)
- {
- if(this.playing)
- {
- this.playObj.movieClip.gotoAndPlay(2);
- }
- else
- {
- this.playObj.movieClip.gotoAndStop(2);
- }
- }
- else
- {
- this.targetPlayFrame = 2;
- this.skipFrames = this.playObj.movieClip._currentframe - numFrames - 2;
- this.sliceToLoad = this.playObj.sliceNum - 1;
- while(this.playBuff.length > 0)
- {
- nextObj = this.playBuff.shift();
- this.loadBuff.push(nextObj);
- }
- this.waitingToPlay = true;
- if(this.loading)
- {
- this.loadBuff.push(this.loadObj);
- this.loading = false;
- }
- }
- }
- else
- {
- this.targetPlayFrame = 2;
- }
- this.settingLoadParameters = false;
- };
- smartLoader_c.prototype.playMovie = function(parentThis)
- {
- var lastIndex = parentThis.smMovieClip._url.lastIndexOf("/");
- var lastBSIndex = parentThis.smMovieClip._url.lastIndexOf("\\");
- if(lastIndex < lastBSIndex)
- {
- lastIndex = lastBSIndex;
- }
- lastIndex += 1;
- this.baseName = parentThis.smMovieClip._url.slice(0,lastIndex);
- this.baseName += parentThis.baseName;
- this.loading = false;
- this.fps = Number(parentThis.fps);
- this.numSlices = parentThis.numSlices;
- this.parentThis = parentThis;
- this.loadBuff = new Array();
- this.playBuff = new Array();
- this.waitingToPlay = true;
- this.playing = true;
- this.sliceToLoad = 0;
- this.targetPlayFrame = 2;
- this.skipFrames = 0;
- this.rewinding = false;
- this.hasSetPosition = false;
- i = 0;
- while(i < 3)
- {
- parentThis.smMovieClip.createEmptyMovieClip("Movie_" + i,parentThis.smMovieClip.getDepth() + i + 1);
- tmpObject = new Object();
- tmpObject.movieClip = parentThis.smMovieClip["Movie_" + i];
- tmpObject.sliceNum = -1;
- tmpObject.depth = tmpObject.movieClip.getDepth();
- this.loadBuff.push(tmpObject);
- i++;
- }
- this.prevFrames = new array(this.numslices);
- this.prevFrames[0] = 0;
- i = 1;
- while(i < this.numSlices)
- {
- this.prevFrames[i] = this.prevFrames[i - 1] + parentThis.numFIS[i - 1] - 2;
- i++;
- }
- this.totalFrames = this.prevFrames[this.numSlices - 1] + parentThis.numFIS[this.numSlices - 1] - 2;
- this.settingLoadParameters = false;
- this.preloadMovie();
- this.intervalref = setInterval(this,"preloadMovie",200);
- };
- delete this.smartLoader;
- this.smartLoader = new this.smartLoader_c();
- this.smartLoader.playMovie(this);
- stop();
-