I’m trying to animate a fader along a motion path (each frame has a stop in the actions layer and there are 30 frames total). I want to be able to find what the currentFrame is and pass a targetFrame … then have a for loop move to the prevFrame/nextFrame arcordingly. I think I’m just getting turned around in the for loop right now. Been a long time since I’ve written one. I could be going about this all wrong but the jist is that I have a mixing console and I’ve got some faders (movieclips) on it and they are all on motion guides (so they stay where they are supposed too). I want to be able to make each one move to a certain place when a button is clicked (so I was thinking of making the above into a class)
Well I did some fiddling around and here’s what I have thus far:
var currentFrame = 0;
var targetFrame = 0;
var newTargetFrame = 0;
//of course I will have to pass in some of these values(working on that)
//current and target frames are the same
if (currentFrame == targetFrame){
this.stop();
}
//moving backwards from curent to target frame
if (currentFrame > targetFrame){
newTargetFrame = currentFrame - targetFrame;
for (i=0; i<newTargetFrame; i++){
this.prevFrame();
}
currentFrame = targetFrame;
}
//moving forwards from current frame to target frame
if (currentFrame > targetFrame){
newTragetFrame = currentFrame + targetFrame;
for (i=0; i>newTargetFrame; i++){
this.netFrame();
}
currentFrame = targetFrame;
}
Well so much for that I can’t figure out what I’m doing wrong … do I need more code than this? if I set the newTarget to 15 nothing happens