jacobted
asked on
How to link a slider bar to play frames of a movie clip in Flash
I am trying to link a slider bar to control a sequence of images I have in a movie clip. It is a 3d rotation of a TV. I have created a slider with a line and dragger, I followed the tutorial from http://www.kirupa.com/developer/mx/slider.htm
Here is the code I have in frame 1 of the movie clip that is my slider:
this.ratio=0 ;
dragger.onPress=function() {
this.startDrag(true,0,0,0, ((line._he ight)-120) );
this.onEnterFrame=function (){
ratio=Math.round(this._y*1 00/line._h eight) ;
}
}
dragger.onRelease=dragger. onreleaseO utside=sto pDrag;
And here is the code I have in frame 1 of the movie it appears in:
this.onEnterFrame=function (){
ratio.text=mySlider.ratio;
}
My movie clip is called Images. The action script above the movie clip Images I got off a tutorial and looks like this.
Images.stop();
var startX:Number;
var startFrame:Number;
var changeDistance:Number;
var travelDistance:Number;
Images.onPress = pressHandler;
Images.onRelease = releaseHandler;
Images.onReleaseOutside = releaseHandler;
function pressHandler():Void {
startX = Images._xmouse;
startFrame = Images._currentframe;
this.onMouseMove = moveHandler;
}
function releaseHandler():Void {
this.onMouseMove = null;
}
function moveHandler():Void {
changeDistance = Math.round((Images._xmouse -startX)/1 0);
travelDistance = startFrame+changeDistance;
if (travelDistance>Images._to talframes) {
Images.gotoAndStop(travelD istance%Im ages._tota lframes);
} else if (travelDistance<0) {
Images.gotoAndStop(Images. _totalfram es+(travel Distance%I mages._tot alframes)) ;
} else {
Images.gotoAndStop(travelD istance);
}
}
Here is the code I have in frame 1 of the movie clip that is my slider:
this.ratio=0 ;
dragger.onPress=function()
this.startDrag(true,0,0,0,
this.onEnterFrame=function
ratio=Math.round(this._y*1
}
}
dragger.onRelease=dragger.
And here is the code I have in frame 1 of the movie it appears in:
this.onEnterFrame=function
ratio.text=mySlider.ratio;
}
My movie clip is called Images. The action script above the movie clip Images I got off a tutorial and looks like this.
Images.stop();
var startX:Number;
var startFrame:Number;
var changeDistance:Number;
var travelDistance:Number;
Images.onPress = pressHandler;
Images.onRelease = releaseHandler;
Images.onReleaseOutside = releaseHandler;
function pressHandler():Void {
startX = Images._xmouse;
startFrame = Images._currentframe;
this.onMouseMove = moveHandler;
}
function releaseHandler():Void {
this.onMouseMove = null;
}
function moveHandler():Void {
changeDistance = Math.round((Images._xmouse
travelDistance = startFrame+changeDistance;
if (travelDistance>Images._to
Images.gotoAndStop(travelD
} else if (travelDistance<0) {
Images.gotoAndStop(Images.
} else {
Images.gotoAndStop(travelD
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.