Ok, this is based on funkysoul's XML mp3 player tutorial. We are going to be adding a function that will allow the user to jump to whatever part of the song that they want.
First, you must MAKE SURE YOUR SCRUB BAR IS ALIGNED AT THE VERY LEFT!
Like so:
<img src="http://img507.images...arightbn3.gif">
Its actually not much code at all:
Assuming your load\scrub bar is instance named "loader", insert this is in the actionscript frame's actionscript.
loader.onRelease = function() { if(_root.loader._xmouse < 0) { xmouse = -1 * _root.loader._xmouse; } else { xmouse = _root.loader._xmouse; } this._parent.sound_mc.sound_obj.start(xmouse*1.2); }Now for the explanation.
loader.onRelease = function() {Simply says that when the user releases their mouse after click on the scrub bar, we want to call this function.
if(_root.loader._xmouse < 0) { xmouse = -1 * _root.loader._xmouse; } else { xmouse = _root.loader._xmouse; }Checks if the mouses relative position to the scrub bar is negative, if so, it makes it positive. Otherwise it remains the same.
this._parent.sound_mc.sound_obj.start(xmouse*1.2);This tells the mp3 player to begin playing at that position.
See, very easy!
Edited by Nofilicity, 22 October 2007 - 04:55 PM.