dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [AS3] trying to control the frame rate on a movie clip

Hybrid View

  1. #1
    Member
    Join Date
    Dec 2007
    Location
    Kirkland WA.
    Posts
    62

    [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;

  2. #2
    Member
    Join Date
    Dec 2007
    Posts
    39
    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.

  3. #3
    Member
    Join Date
    Dec 2007
    Location
    Kirkland WA.
    Posts
    62
    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?

  4. #4
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,046
    Ok, you are right. The frameRate property only works for the entire stage. Individual MovieClips cannot have independent frame rates.

  5. #5
    Member
    Join Date
    Dec 2007
    Location
    Kirkland WA.
    Posts
    62
    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?

  6. #6
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,046
    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.

  7. #7
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    ^ 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. |


  8. #8
    Member
    Join Date
    Dec 2007
    Location
    Kirkland WA.
    Posts
    62
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center