hello,
i am making an animation which plays out about 30 frames. on frame 30 i have an invisible button, and when released i want it to play all the frames back until it reaches frame 15, at which point it stops. I have the following code but it does not work the way i’m hoping:
on (release) {
if (_currentframe == 15) {
stop();
}
else if (_currentframe != 15) {
prevFrame();
}
}
if anyone can help me out i would greatly appreciate it. thanks in advance.
[AS]// dit moet je zelf goed invullen!!!
var fps = 30;
// vervangt de standaard play() van een movieclip
function playForward(mc) {
clean(mc);
mc.play();
}
// functie om terug af te spelen.
function playBackward(mc, halt) {
mc.onEnterFrame = function() {
if (this._currentframe == 1) {
(halt) ? delete this.onEnterFrame : this.gotoAndStop(this._totalframes);
}
clearInterval(_root.ff);
clearInterval(_root.fb);
this.prevFrame();
}
}
// “stopt” (pauzeert) de mc/swf
function pauze(mc) {
clean(mc);
mc.stop();
}
// stopt de mc echt, en gaat terug naar het 1e frame
function stoppen(mc) {
clean(mc);
mc.gotoAndStop(1);
}
// deze functie speelt de mc versneld af
// gebruik ‘speed’ als factor: bv 2 voor 2x zo snel, of 0.5 voor de helft zo snel
// gebruik ‘halt’ als boolean om de animatie wel of niet te loopen
function fastForward(mc, speed, halt) {
clean(mc);
var time = 1000/fps/speed;
ff = setInterval( function() {
mc.nextFrame();
if (mc._currentframe == mc._totalframes) {
(halt) ? clearInterval(ff) : mc.gotoAndStop(1);
}
}, time);
}
// deze functie speelt de mc versneld terug af
// gebruik ‘speed’ als factor: bv 2 voor 2x zo snel, of 0.5 voor de helft zo snel
// gebruik ‘halt’ als boolean om de animatie wel of niet te loopen
function fastBackward(mc, speed, halt) {
clean(mc);
var time = 1000/fps/speed;
fb = setInterval( function() {
mc.prevFrame();
if (mc._currentframe == 1) {
(halt) ? clearInterval(fb) : mc.gotoAndStop(mc._totalframes);
}
}, time);
}
// verwijdert alle intervallen en de onEnterFrame, als die wordt gebruikt
function clean(mc) {
if (mc.onEnterFrame) mc.onEnterFrame = null;
if (ff) clearInterval(ff);
if (fb) clearInterval(fb);
}
// Als je die interval geen mooie oplossing vind kun je ook een
// functie bedenken die berekent op welke frame de mc/swf moet staan
// en er direct naar verwijst.[/AS]
hey mediamonkey, i think your code is a little too complicated for this problem, and the dutch comments just make it worse. I was trying to get some code working for this but couldnt
Thanks a lot, but I tried your code and it didn’t work for me (and your code was wayyyyyy to confusing with the dutch comments, lol, thanks though). I’ll link to an FLA since the limit on this board is 75k and this one is 112k.
On frame 45 there is an invis button (on top of the work text, instance name workBack) that on release needs to play the frames back until it reaches frame 15 at which point it stops. This is all in the work movieclip (on the bottom under the bottom bar). Many thanks to anyone who can help me as i’ve tried numerous amounts of code with nothing resulting the way i want it to work. http://www.reintroducing.com/index.fla
Alright, i have a bit of a newer problem that involves still the same concept. I duplicated the movie clip so i have two menu’s now, and i have an invisible button on frame 15 that i want to collapse the other menu when this one is clicked. so it’ll be like a see-saw motion where when one is clicked the other reverses its frames, and vice versa. How would i go about doing that? I have tried a lot of things and modifying voet’s code and it wasn’t working right for me… :\ Any help is greatly appreciated.
ahh ****it, i’m sorry again. new problem i didn’t recognize before. so i have the two movie clips at frame 15 when the movie starts (there is a little intro animation of them moving up when it loads the clips, hence why it stops 15 frames down the line waiting for them to be pressed). if i press one of them while none of them are past frame 15, it reverses the frames to frame 1 for the one that wasn’t pressed so it collapses all together under the movie where it is not visible anymore.