Copy link to clipboard
Copied
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
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);
}
Copy link to clipboard
Copied
The frame rate is a one and only, so changing it in one place changes it every place.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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");
}
Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
Thanks Ken
Got it to work with your help.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more