Skip to content

Categories:

How to adjust the frame number in this script?

I have a timeline slider part to my animation which starts at frame 1089 and ends at frame 1173, I have a script which allows me to do this and works perfectly when I build it in a new Flash file starting at frame 1, I need this code to work for the animation I have built at frame 1089, I dont know which number “1′s” in the script relate to the frame number, I have tried changing them all to 1089 but that doesn’t work! at the moment as soon as I click on this it jumps back to frame number 1 – which I believe as the code stands is exactly what it should be doing. Please could anyone edit this code so that it realises which frames I want it to work in?  Thank you in anticipation, Ellie x

 

var numOfFrames:Number = 84; // number of frames in the timeline to scrub

var widthOfScrubber:Number = 500; // width in pixels of scrubber bar

var widthOfScrubberSlider:Number = 25; // width in pixels of scrubber slider

 

var widthOfScrub:Number = widthOfScrubber – widthOfScrubberSlider;

var stepValue:Number = Math.round(widthOfScrub / numOfFrames);

var scrubX:Object = scrubber.scrubberSlider;

var isPlaying:Number = 1;

var home = this;

 

scrubX._x = 0;

 

onEnterFrame = function() {

if (scrubber.activeNow == 1 && isPlaying == 0) {

var frameNum = Math.round(scrubX._x / stepValue);

gotoAndStop(frameNum);

} else if (scrubber.activeNow == 1 && isPlaying == 1) {

var frameNum = Math.round(scrubX._x / stepValue);

gotoAndPlay(frameNum);

} else if (scrubX._x <= widthOfScrub && scrubber.activeNow != 1 && isPlaying == 1) {

scrubX._x = scrubX._x + stepValue;

} else {

isPlaying = 0;

}

}

 

playBTN.onRelease = function() {

scrubber.activeNow = 0;

isPlaying = 1;

home.play();

}

 

pauseBTN.onRelease = function() {

scrubber.activeNow = 0;

isPlaying = 0;

home.stop();

}

 


Go to the Adobe Forums

Posted in Flash.

-->