i have this code for a slider (and buttons) which scrubs/controls the timeline of a movieclip, but i am lost as to how to convert it to actionscript 3. any help would be appreciated. alternatively, does someone know of an as3 example of this functionality?
here is the code:
controller = this;
startR = timeline._x;
endR = startR + timeline._width;
Range = endR-startR;
playSpeed = 0;
slider.onPress = function(){
var offset = this._x - this._parent._xmouse;
this.onMouseMove = function(){
this._x = Math.min(Math.max(startR, this._parent._xmouse + offset), endR);
var percent = (this._x-startR)/Range;
target.gotoAndStop(Math.floor(percent*target._totalframes)+1)
updateAfterEvent();
}
this.onMouseMove();
}
slider.onRelease = slider.onReleaseOutside = function(){
delete this.onMouseMove;
if (playSpeed == 1) target.play()
}
this.onEnterFrame = function(){
if (!slider.onMouseMove){
if (playSpeed != 1) target.gotoAndPLay(Math.round(target._currentframe+playSpeed));
// playSpeed of 1 is handled with play() so that synced audio can play
if (target._currentframe == target._totalframes) playSpeed = 0;
var percent = (target._currentframe-1)/(target._totalframes-1);
slider._x = startR + Range*percent;
}
}
// Buttons
start_btn.onRelease = function(){
playSpeed = 0;
target.gotoAndStop(1);
}
rw_btn.onPress = function(){
this.orig = playSpeed;
playSpeed = -2;
}
rw_btn.onRelease = rw_btn.onReleaseOutside = function(){
playSpeed = this.orig;
if (playSpeed == 1) target.play();
}
stop_btn.onRelease = function(){
playSpeed = -1;
}
play_btn.onRelease = function(){
playSpeed = 1;
target.play();
}
ff_btn.onPress = function(){
this.orig = playSpeed;
playSpeed = 2;
}
ff_btn.onRelease = rw_btn.onReleaseOutside = function(){
playSpeed = this.orig;
if (playSpeed == 1) target.play();
}
end_btn.onRelease = function(){
playSpeed = 0;
target.gotoAndStop(target._totalframes);
}
if this is way to complicated for someone to do it in his spare time, maybe someone is interested in creating this functionality for me in as3, paid of course?
thanks in advance, semiotic