Skip to main content
Inspiring
June 13, 2013
Answered

change the fps rate

  • June 13, 2013
  • 1 reply
  • 855 views

Hi

How to change the fps rate in as2

This topic has been closed for replies.
Correct answer kglad

you can't change the framerate with actionscript using as2.  you can with as3 and, you can fake it and play any movieclip at any (approx) framerate (forwards or backwards), no greater than the native frame rate, using playF:

to play a movieclip (eg, _root from frame 1 to its last frame 24 fps):

playF(_root,1,_root._totalframes,24);  // to stop it, use stopF(_root);

function playF(mc, m, n, fps) {

    playFFF2 = function(mc) {

        trace(getTimer());

        if (mc.m<mc.n) {

            mc.nextFrame();

        } else {

            mc.prevFrame();

        }

        if (mc._currentframe == mc.n) {

            clearInterval(mc.int);

        }

        updateAfterEvent();

    };

    mc.m = m;

    mc.n = n;

    mc.fps = fps;

    mc.gotoAndStop(mc.m);

    clearInterval(mc.int);

    mc.int = setInterval(playFFF2, 1000/mc.fps, mc);

}

function stopF(mc) {

    clearInterval(mc.int);

}

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 13, 2013

you can't change the framerate with actionscript using as2.  you can with as3 and, you can fake it and play any movieclip at any (approx) framerate (forwards or backwards), no greater than the native frame rate, using playF:

to play a movieclip (eg, _root from frame 1 to its last frame 24 fps):

playF(_root,1,_root._totalframes,24);  // to stop it, use stopF(_root);

function playF(mc, m, n, fps) {

    playFFF2 = function(mc) {

        trace(getTimer());

        if (mc.m<mc.n) {

            mc.nextFrame();

        } else {

            mc.prevFrame();

        }

        if (mc._currentframe == mc.n) {

            clearInterval(mc.int);

        }

        updateAfterEvent();

    };

    mc.m = m;

    mc.n = n;

    mc.fps = fps;

    mc.gotoAndStop(mc.m);

    clearInterval(mc.int);

    mc.int = setInterval(playFFF2, 1000/mc.fps, mc);

}

function stopF(mc) {

    clearInterval(mc.int);

}

Inspiring
June 14, 2013

okay thanks

kglad
Community Expert
Community Expert
June 14, 2013

you're welcome.