Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

increase frame rate within flash animation

Guest
Aug 10, 2011 Aug 10, 2011

Any way that I can adjust the frame rate of a movieclip without affecting the frame rate that I set for the rest of the document.

I want to speed up the animation of this clip and it would be difficult to adjust the timeline of this clip to accomplish this.

thanks

TOPICS
ActionScript
5.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 11, 2011 Aug 11, 2011

An example. I have a MovieClip called movieclip on stage. This movieclip has stop() in the frame 1. Below will play movieclip in the double speed of the stage frameRate, and it loops.

import flash.events.Event;

addEventListener(Event.ENTER_FRAME, enterFrame);

function enterFrame(e:Event):void {
    var targetFrame:uint = movieclip.currentFrame + 2;
    if(targetFrame > movieclip.totalFrames) targetFrame = 0;
    movieclip.gotoAndStop(targetFrame);
}
Translate
LEGEND ,
Aug 10, 2011 Aug 10, 2011

The frame rate is a one and only, so changing it in one place changes it every place.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 10, 2011 Aug 10, 2011

I did some google searches and some folks offered some coding that did not work and others said the same thing as you.

Looks like I'll have to adjust my timeline

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 10, 2011 Aug 10, 2011

Ned is correct, your frame rate will affect the whole. but you can control that by assigning and reverting wherever you want by

stage.frameRate=30;

and at the specific frame you can revert it back as

stage.frameRate=24;

Try with this, but whever you apply if affect the whole.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 11, 2011 Aug 11, 2011

You can tell your MovieClip to gotoAndStop() on enterFrame event. If you tell it to skip every other frame the MovieClip will play 2 x the speed of stage frameRate. If you tell it to go to the next frame on every other enterFrame event the MovieClip will play 1/2 the speed of stage frameRate.

This would only work for non-script, timeline based animation though.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 11, 2011 Aug 11, 2011

Ken,

I used your enterFrame event idea (along with frame labels on every other frame) and it works fine. Only issue is that I want the animation to keep looping but it does not - It goes back to frame 1 and stops there - any other suggestions.

Here is my sample coding for the timeline in AS3

addEventListener(Event.ENTER_FRAME,enterFrameFunction);

function enterFrameFunction(event:Event) {

gotoAndPlay("b");

}

addEventListener(Event.ENTER_FRAME,enterFrameFunction2);

function enterFrameFunction2(event:Event) {

gotoAndPlay("c");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 11, 2011 Aug 11, 2011

An example. I have a MovieClip called movieclip on stage. This movieclip has stop() in the frame 1. Below will play movieclip in the double speed of the stage frameRate, and it loops.

import flash.events.Event;

addEventListener(Event.ENTER_FRAME, enterFrame);

function enterFrame(e:Event):void {
    var targetFrame:uint = movieclip.currentFrame + 2;
    if(targetFrame > movieclip.totalFrames) targetFrame = 0;
    movieclip.gotoAndStop(targetFrame);
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 11, 2011 Aug 11, 2011
LATEST

Thanks Ken

Got it to work with your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines