-
[AS3] trying to control the frame rate on a movie clip
I'm trying to control the frame rate on a movie clip ( i want the movie to flash at a speed controled by a knob) currently i have a tweened time line that fades in and out over the course of 20 frames. and the knob i have to control it is set to play that movie clip and set the frame rate at the same time. i have placed a trace statement on the knob rotation and the frame rate of the second clip. they both seem to show a decreas and increase of rate and angle as i turn the knob but vissually it looks same. any ideas? (i have enclosed just a part of my knob rotation code it is ugly i know i should have done an array) thank you for the help
Code:
his.fan_knob.addEventListener(Event.ENTER_FRAME, fan3);
fan_knob.buttonMode = true;
function fan3(evt:Event):void {
if (this.ok) {
trace("knob "+ fan_knob.rotation);
var xVar = this.mouseX-fan_knob.x;
var yVar = this.mouseY-fan_knob.y;
MovieClip(root).texting.gotoAndStop(9);
fan_knob.rotation = Math.max(0, Math.min(180, Math.abs(-(Math.atan2((yVar), -(xVar))*(180/Math.PI)))));
} if (0 < fan_knob.rotation && fan_knob.rotation < 20 && (0 < MovieClip(root).hvac_knob.hvac_knob.rotation && MovieClip(root).hvac_knob.hvac_knob.rotation < 96) && (MovieClip(root).AC_Heat.currentFrame == 3)) {
MovieClip(root).cool.cool.gotoAndPlay(10);
MovieClip(root).cool.cool.frameRate =5;
} else if (20 < fan_knob.rotation && fan_knob.rotation < 40 && (0 < MovieClip(root).hvac_knob.hvac_knob.rotation && MovieClip(root).hvac_knob.hvac_knob.rotation < 96) && (MovieClip(root).AC_Heat.currentFrame == 3)) {
MovieClip(root).cool.cool.gotoAndPlay(10);
MovieClip(root).cool.cool.frameRate =10;
-
I'm not so sure, but i think that MC speed isn't important. It uses the main timeline framerate. But as i said , i'm not so sure, and i can't test it right now. So test it in new movie and see if the MC framerate is controled by main timeline framerate.
-
i think you are right about the movie using the main time line rate but i want to try to change the frame rate of a nested movie clip. does anybody know if that is possible?
-
Bearded (M|G)od
Ok, you are right. The frameRate property only works for the entire stage. Individual MovieClips cannot have independent frame rates.
-
oh well
any idea which direction i should research to figure out how to make it look like a knob is increasing the flashing of something?
-
Bearded (M|G)od
you could always attempt to simulate things using a Timer to emulate a different frame rate. If you are doing that, I would suggest setting your stage frame rate to at least the highest possible frame rate. That way you can simulate a slower rate better.
-
trace("AKA: Biro Barna");
^ yeah, that should work.
| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro | WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
| Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/ | By perseverance the snail reached the ark. |
-
ok good idea and thank you for the heads up on the frame rate settings. i will work on that today, and try not to bug you guys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|