Controlling Framerates within swf

Is there a way to adjust framerates within a flash movie?\r\rWhat I am trying to accomplish is:\r\rproduct demo at normal speed until I need to demonstrate a mouse clicking on a button. I want to show a smooth mouse trail, but can only do so when the FPS is above 20.\r\rCan I specify a framerate of ‘x’ until frame 30 and framerate ‘y’ starting at frame 31 and back to framerate ‘x’ at frame 45?\r\rAny thoughts or better ways to do this?\r\rThanks

there is no way to specify a framerate during run-time. You must specify before you export the SWF and once you specify there is no way to change it.

You could try to emulate it. For instance, you could make your mouse invisible every other frame… It’s easy to do with the modulo operator % and a simple counter.

 onClipEvent (enterFrame) {\r\ri++ ;\r\rif (i%2) _visible = 0 ;\r\relse _visible = 1 ;\r\r}

Just a thought;\rpom 0]

Doesn’t work at all. :frowning: \r\rpom 0]

nice try Pom-pom

you can control the frame rate of movies but it’s complicated and you may not get very good results.\rbasically you set your frame rate to 120fps - the maximum flash 5 allows…then you create a control clip that will increment your clips frame by frame according to time. you will want to attach that movie, and have it target whatever movie you want to play and tell it what frame rate you want.\rit’s kinda like prototyping a play action where you set the frame rate.\rthe problem with that is your movie may bog down on slower machines so you lose the low end computer users out there.\r:) \rjeremy\r\rp.s. i just might make a sample file, but only if there is enough demand for this sort of thing.

Demand ! Demand ! Anything you do I take, Sinf !\r\rpom 0]

ok, ok, i made the sample file. it’s actually very simple. instructions on use are in the fla.\rif anyone finds this useful, HIRE ME.\\r:) \rjeremy

lol…still no luck w/ work Sinf? I could get ya a job a McDonalds…:slight_smile:

i don’t think mcdonald’s pays very well.\ranyways, has anyone tried the file? it’s very powerful if you want to have movies run at different frame rates. it doesn’t bog down as much as clips with ‘onClipEvent(enterFrame)’ actions.\r:) \rjeremy

you’re right, it pays sh!t. I’ve been there almost 4 years now and I only make 7.50 (bcuz i just got a raise). Some pay good, but not the ones that are owned by Tom Clark…cheap a$s motherphucker…oh well…I’ll check out that file…\r\r\rI checked it out…its like Japanese to me…but interesting. You scare me Sinf. Why in the hell would anyone lay you off?

ok POM, have you checked out the file???\rit really does work!\r:P\rjeremy

No time yet. I’ll do that in a few hours. I’m not too good at Japanese either, but we’ll see…\rpom 0]

2 things :\r\r- I don’t understand how it works. I don’t know maybe there’s something I’m missing, but your code really doesn’t make sense to me.

 _root.mcLocal = this; // why did you do this ?\r\r_root.nCount = 0;\r\rfunction fPlayControl (mc, fps) {\r\r&nbsp &nbsp &nbsp &nbsp if (fps>0 and fps<=120) {\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mc.stop();\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.mcLocal.attachMovie("mcPlayControl", "mcPlayControl"+_root.nCount, _root.nCount);\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.mcLocal["mcPlayControl"+_root.nCount].mcMovie = mc; // ??\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.mcLocal["mcPlayControl"+_root.nCount].nFPS = fps; // ??\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.nCount++;\r\r&nbsp &nbsp &nbsp &nbsp }\r\r}

I don’t see WHERE you change the FPS.\r\r- I tested the movie with a button that does

 on (press) {\r\r&nbsp &nbsp &nbsp &nbsp _level10.fPlayControl(_root.rond,30);\r\r}

It works very well, but if press more than once, the clip goes faster and faster. I can’t see why, but I just thought I should mention it.\r\rThanks for any explanation you can give, because I’m lost here.\r\rpom 0]

_root.mcLocal = this; // why did you do this ?\r// i put that in the code so that the ‘fPlayControl’ function will target the right swf - itself - because this file if meant to be loaded and used as a means of controlling the frame rate.\r_root.nCount = 0;\rfunction fPlayControl (mc, fps) {\rif (fps>0 and fps<=120) {\rmc.stop();\r_root.mcLocal.attachMovie(“mcPlayControl”, “mcPlayControl”+_root.nCount, _root.nCount);\r_root.mcLocal[“mcPlayControl”+_root.nCount].mcMovie = mc; // ??\r// ‘mc’ is a reference to the movie clip that is to be controlled.\r_root.mcLocal[“mcPlayControl”+_root.nCount].nFPS = fps; // ??\r// ‘fps’ is the desired frame rate.\r_root.nCount++;\r }\r}\r\rthe reason your clip keeps going faster and faster is because there are more clips on the stage that are all telling one clip (_root.rond) to go to the next frame. i am going to change the file now so that there can be no redundant control clips.\ri’ll post again when it’s done…i gotta go to the store right now so it’ll be about an hour until i update the file.\r:) \rjeremy\r\rp.s. i’ll comment the code in the fla too, so it’s easier to take apart and figure out!

ok, i fixed the duplicate control clip problem.\\rall the code is commented now.\r:) \rjeremy

the reason your clip keeps going faster and faster is because there are more clips on the stage that are all telling one clip (_root.rond) to go to the next frame
But where do you tell the clip to go to the next frame ? That’s what I couldn’t find.\r\rpom 0] \r\redit : OK, I hadn’t edited the movie clip… Let me see.

there’s one movie in the library, it’s in there.\r:) \rjeremy

I was wondering : you have one loop frame in mcPlayControl. Doesn’t that delay everything ? I mean, you tell the movie clip to go forward every other frame, don’t you ?\r\rpom 0]

nope, it executes every frame. flash handles all the code in a frame before drawing what’s on stage in that frame. when you use ‘gotoAndPlay’, the playhead never really reaches the frame with the ‘gotoAndPlay’ it just executes the code and moves on to execute the code on the frame it’s supposed to go to next.\rto prove this theory, try this experiment:\rmake a 2 frame movie.\rin the second frame put this…\rgotoAndPlay(_currentframe-1);\rnow test the movie with the ‘bandwidth profiler’ showing.\rthe playhead never leaves the first frame - even though the movie is ‘playing’. if you place anything on the stage in frame 2 and nothing in frame 1, you will never see what’s on the stage.\r:) \rjeremy