Revision: 5067
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 8, 2008 15:11 by jmelgoza
Initial Code
//***mp3 loader
_root.createEmptyMovieClip("seek",1)
seek.w=140 // seek bar width
seek.h=20 // seek bar height
seek.b=2 // seek bar border
seek.plc="0xff0000" // seek bar preload color
seek.bgc="0x000000" // seek bar background color
seek.fgc="0xffffff" // seek bar foreground color
plw=seek.w-2*seek.b
MovieClip.prototype.drawSquare=function(w,h,l,t,c) {
with(this){
clear()
beginFill(c,100)
moveTo(l,t)
lineTo(l+w,t)
lineTo(l+w,t+h)
lineTo(l,t+h)
lineTo(l,t)
endFill()
}
return this
}
seek.jump=function() {
mp3.start((((seek.bg._xmouse-seek.b)/plw)*(mp3.duration/loaded))/1000)
}
seek.createEmptyMovieClip("bg",1).drawSquare(seek.w,seek.h,0,0,seek.bgc)
seek.createEmptyMovieClip("pl",2).drawSquare(1,seek.h-2*seek.b,0,seek.b,seek.plc)._x=seek.b
seek.createEmptyMovieClip("fg",3).drawSquare(1,seek.h-2*seek.b,0,seek.b,seek.fgc)._x=seek.b
mp3=new Sound()
mp3.loadSound("diggnation.mp3", true)
mp3.start(0)
seek.pl.onEnterFrame=function () {
out=loaded=mp3.getBytesLoaded()/mp3.getBytesTotal()
this._width=plw*loaded
seek.fg._width=out2=(mp3.position/(mp3.duration/loaded))*plw
}
seek.pl.onPress=function () {
seek.jump()
this.onMouseMove=function () {
if (this.hitTest(_root._xmouse,_root._ymouse,false)){seek.jump()}
}
}
seek.pl.onRelease=seek.pl.onReleaseOutside=function () {
delete this.onMouseMove
}
Initial URL
Initial Description
Initial Title
Mp3 loader with seek
Initial Tags
textmate
Initial Language
Other