A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [F8] How can I change framerate? for (slow motion)

Hybrid View

  1. #1
    talk to the hand! Never_land:('s Avatar
    Join Date
    Nov 2007
    Location
    your mother's bedroom
    Posts
    490

    [F8] How can I change framerate? for (slow motion)

    I can`t find a way to change framerate during the game.
    If I try to change all speeds the animation looks weird.
    pls help me.
    thnx in advance

  2. #2
    Trainee coder Viza's Avatar
    Join Date
    Sep 2006
    Location
    Melbourne, Down under
    Posts
    513
    I believe it is possible in AS3 to change the framerate at runtime, though it'd be a whole lot trickier with AS2.

    I'd take a look at time based animation (for an AS2 solution): Time based animation tutorial.
    Unfortunately, you may need to re-write the entire engine to run under time triggered events. -depending on how flexible you've made it so far.

    Viza.

  3. #3
    talk to the hand! Never_land:('s Avatar
    Join Date
    Nov 2007
    Location
    your mother's bedroom
    Posts
    490
    the link has 2 swfs 5fps and 30fps

    I`m trying to make a slow motion sceenario for a game
    I`m not changing enterframe vars to make speeds slower cuz animations can`t slow down.

  4. #4
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    you have to change the way your animations run. The way I would do it:

    create 1 enterFrame
    give every object control through this one enterFrame, call: myObject.control()
    no animation should use gotoAndPlay()
    on every start frame of every animation sequence add a stop()
    on every objects control function write: currentAnimation.nextFrame()

    when using gotoAndStop(newLabel) you must update currentAnimation to the object that exists there. And any animation that needs looping, you must put (in the mc) gotoAndStop(1) at the end of the animation

    now to go slowMo:

    _root.onEnterFrame = null;
    interval = setInterval(_root, "control", 40);

    to return:

    clearInterval(interval)
    _root.onEnterFrame = _root.control;
    Last edited by mr_malee; 11-20-2007 at 03:44 AM.
    lather yourself up with soap - soap arcade

  5. #5
    talk to the hand! Never_land:('s Avatar
    Join Date
    Nov 2007
    Location
    your mother's bedroom
    Posts
    490
    Quote Originally Posted by mr_malee
    you have to change the way your animations run. The way I would do it:

    create 1 enterFrame
    give every object control through this one enterFrame, call: myObject.control()
    no animation should use gotoAndPlay()
    on every start frame of every animation sequence add a stop()
    on every objects control function write: currentAnimation.nextFrame()

    when using gotoAndStop(newLabel) you must update currentAnimation to the object that exists there. And any animation that needs looping, you must put (in the mc) gotoAndStop(1) at the end of the animation

    now to go slowMo:

    _root.onEnterFrame = null;
    interval = setInterval(_root, "control", 40);

    to return:

    clearInterval(interval)
    _root.onEnterFrame = _root.control;
    tnx Mr malee you saved the day
    I earned the slow motion ability

    one last thing
    I have to learn AS3 and get flash cs3 to make the game faster
    do you have any links to learn as3
    I heard "as2 to as3" is like "playstation2 to playstation3" or something like that

  6. #6
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Quote Originally Posted by Never_land:(
    I heard "as2 to as3" is like "playstation2 to playstation3" or something like that
    Hehe, more like nintendo to super nintendo. But it's definitely worth the effort. It's hardly a beginners tutorial, but the AS3 language reference is invaluable once you get started. The best way to get started to play around
    with the new graphics API, Bitmaps, and Sprites.

    http://www.adobe.com/go/as3lr

    I think Adobe has published some "AS2 to AS3 Migration Tips" somewhere, but I couldn't come up with the URL. I read it - I didn't find it especially helpful. My view is AS2 is all about MovieClips, while AS3 is all about Sprites. I very rarely interact with MovieClip timelines anymore. I find AS3 much more similar to java than to any previous version of AS, it's more strongly typed and does a better job of standing on its own as a development platform than the previous version of AS, which still involved a lot of manipulation in the flash IDE.

  7. #7

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