home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 March
/
CMCD0305.ISO
/
Software
/
Demo
/
Elearn
/
Fizica
/
vol2
/
v2_FIX01
/
01OG
/
opticaG3.swf
/
scripts
/
MediaPlayer.as
< prev
next >
Wrap
Text File
|
2005-01-03
|
6KB
|
226 lines
Object.MediaPlayerClass = function()
{
var s = "@";
this.filmDiv = "filmuletzDIV";
if(this.behaviour == 1)
{
this.cMovie = 0;
}
else
{
this.cMarker = "";
this.watch("cMarker",function(id, o, n)
{
this.cMarker = n;
this.setCMarker();
}
);
}
this.mEnded = 0;
this.fromMarker = undefined;
this.end = 0;
this.watch("mEnded",function(id, o, n)
{
this.mEnded = n;
this.setMEnded();
}
);
this.onLoad = function()
{
this.loadRadioBtn();
this.cMarker = 0;
this.continuous = false;
this.ply = 0;
this.playBtn.cntrl = this;
this.playBtn.onRelease = function()
{
if(this.cntrl.ply == 0)
{
this.cntrl.playM();
}
else
{
this.cntrl.pauseM();
}
};
getURL("FSCommand:register",this.filmDiv + s + this);
this.update(this.filmDiv,this.films[0],this.x,this.y,this.width,this.height,this.loopM[this.cMovie]);
this.pauseM();
};
};
Object.MediaPlayerClass.prototype = new MovieClip();
Object.MediaPlayerClass["extends"](MovieClip);
Object.MediaPlayerClass.prototype.update = function(div, film, x, y, width, height)
{
var s = "@";
getURL("FSCommand:load",div + s + film + s + x + s + y + s + width + s + height + s + this.loopM[this.cMovie]);
if(this.behaviour == 1)
{
this._parent.setMv(this.cMovie);
this.lMovie = this.cMovie;
this["rd" + this.cMovie].setState(true);
}
};
Object.MediaPlayerClass.prototype.playM = function()
{
var s = "@";
this.ply = 1;
this.playBtn.gotoAndStop("Play");
if(this.behaviour == 1 && this.lMovie != this.cMovie)
{
this.update(this.filmDiv,this.films[this.cMovie],this.x,this.y,this.width,this.height,this.loopM[this.cMovie]);
this["rd" + this.cMovie].setState(true);
}
if(this.behaviour == 1 && this.end == 1)
{
this._parent.mediaPlayerStateIs(2);
this.end = 0;
}
if(this.behaviour == 0 && this.end == 1)
{
this.end = 0;
this.cMarker = 0;
}
this._parent.mediaPlayerStateIs(1);
getURL("FSCommand:play",this.filmDiv);
};
Object.MediaPlayerClass.prototype.pauseM = function()
{
var s = "@";
this.ply = 0;
this._parent.mediaPlayerStateIs(0);
this.playBtn.gotoAndStop("Stop");
getURL("FSCommand:pause",this.filmDiv);
};
Object.MediaPlayerClass.prototype.stopM = function()
{
var s = "@";
this.ply = 0;
this._parent.mediaPlayerStateIs(0);
this.playBtn.gotoAndStop("Stop");
getURL("FSCommand:stop",this.filmDiv);
};
Object.MediaPlayerClass.prototype.loadRadioBtn = function()
{
var i = 0;
while(i < this.moments.length)
{
if(this.aBtn == true)
{
var mc = this.attachMc("FRadioButtonSymbol","rd" + i,100,i * 25 + 5);
mc.setLabel(this.moments[i]);
mc.setData(i);
mc.setGroupName("radioGroupM");
}
else
{
this["rd" + i] = this._parent["rd" + i];
this["rd" + i].setData(i);
this["rd" + i].setGroupName("radioGroupM");
}
i++;
}
if(this.aBtn == false)
{
this.radioGroupM = this._parent.radioGroupM;
}
if(this.behaviour == 0)
{
this.radioGroupM.setChangeHandler("setCurrentMarker",this);
trace(this.radioGroupM.setChangeHandler);
}
else
{
this.radioGroupM.setChangeHandler("setCurrentMovie",this);
}
};
Object.MediaPlayerClass.prototype.setCurrentMarker = function()
{
var s = "@";
this.end = 0;
var mk = arguments[0].getData();
if(undefined == mk)
{
mk = arguments[0];
}
getURL("FSCommand:setCurrentMarker",this.filmDiv + s + mk);
if(mk == 0)
{
this.cMarker = 0;
}
this.fromMarker = mk;
this.playM();
};
Object.MediaPlayerClass.prototype.setCMarker = function()
{
this["rd" + this.cMarker].setState(true);
this._parent.setMv(this.cMarker);
if(this.continuous == false)
{
this.pauseM();
}
};
Object.MediaPlayerClass.prototype.setCurrentMovie = function()
{
var s = "@";
var mk = arguments[0].getData();
if(undefined == mk)
{
mk = arguments[0];
}
this.cMovie = mk;
this.playM();
};
Object.MediaPlayerClass.prototype.setContinuous = function()
{
this.continuous = arguments[0].getValue();
if(this.continuous == true)
{
this.playM();
}
var i = 0;
while(i < this.moments.length)
{
this["rd" + i].setEnabled(!this.continuous);
i++;
}
};
Object.MediaPlayerClass.prototype.setMEnded = function(arg)
{
this.end = 1;
if(this.behaviour == 1 && this.cMovie < this.films.length - 1)
{
if(this.loopM[this.cMovie] == 1 && this.continuous == false)
{
this._parent.mediaPlayerStateIs(2);
this._parent.mediaPlayerStateIs(1);
this.end = 0;
return undefined;
}
this.cMovie = this.cMovie + 1;
if(this.continuous == true)
{
this.playM();
}
else
{
this.pauseM();
}
}
else
{
if(this.loopM[this.cMovie] == 1)
{
this.end = 0;
return undefined;
}
this.pauseM();
}
};
Object.MediaPlayerClass.prototype.onUnload = function()
{
this.stopM();
getURL("FSCommand:hide",this.filmDiv);
};
Object.registerClass("MediaPlayer",Object.MediaPlayerClass);