How do you make it so that you can make the frame rate on one object 12 and the other 6?
use setInterval and instead of running your actions through an onEnterFrame event, use the function put in the setInterval call. i.e.
this.createEmptyMovieClip("a",1);
this.createEmptyMovieClip("b",2);
a.fps = 6;
a.onRun = function(){
trace("a frame");
}
b.fps = 12;
b.onRun = function(){
trace("b frame");
}
a.interval = setInterval(a, "onRun", (1000/a.fps));
b.interval = setInterval(b, "onRun", (1000/b.fps));
ok, thx
That’s sweet, Sen
[SIZE=1]rate! rate! rate![/SIZE]
so i can now load movieClip in different fps…
i mean can i load movieClips in another movieClip with 12 fps and in the same movieClip load movieClip with 24 fps :sure:
is it possible?
[color=red]FlashSwimmer[/color]
well no not really. There are some limitations to this. 1), this works for code execution, only running the onRun call in that interval and only for that movieclip. This doesnt apply to animation which will remain at the fps of the main movie. Now you can use this on a movieclip, stop() it and then use nextFrame(); updateAfterEvent(); in the onRun command to in essense change the animation fps of that clip. But again, this would only be for that specific clip and not any children clips i.e. using this on clip a wont also effect clip a.b
Same thing applies with loaded movies because this doesnt change the fps of anything, it just sets a timer to base code execution off of. Any enterFrame event in a loaded movie will continue to run at the main movies fps and if attempted on a loaded movie, it would only effect the _root of that movie (or really whatever it is you tried to use it on).
Actually there is a way to change the framerate of a movie at runtime without using setInterval.
Here’s an example. Let’s say I have a 30fps movie, but I want it to run at only 2fps when a button is clicked.
First I make an SWF with a silent streaming sound starting in the first frame and continuing in the second frame. The framerate for this SWF is set to 2fps. Publish this movie as “2fps.swf”.
Next, in my main movie I set the framerate to 30fps, plop down a button and give it an action something like this:
on(release){
loadMovieNum(“2fps.swf”, 777);
}
Now add any animation you want to this movie and publish it. When you test it out, the animation will run at 30fps, but when you click the button, the animation will continue at only 2fps.
This happens because streaming sounds set the framerate of a movie. So when you load a 2fps movie with a streaming sound, the whole main movie has to run at that framerate to keep the sound streaming properly.
Of course there are problems with this. If you want more choices for framerates, you have to publish a separate swf with a silen sound and the framerate you want. Also, you can’t have any other streaming sounds in the main movie, it just won’t work.
-Al
and that sets the entire movie to that framerate, not just the loaded movie (so you cant have more than one frame rate at any one time)