6 Replies Latest reply on May 20, 2008 10:35 AM by Newsgroup_User

    Frame rate goes crazy with editable text sprite

    Level 7
      This one is annoying - I have a lot of things that depend on a steady,
      predictable frame rate. But whenever you have the mouse button held down on
      an editable text sprite, the frame rate goes through the roof. I don't know
      what the numbers are exactly, but everything runs MUCH faster than it
      should. This can result in some major timing mis-syncs for other events
      happening on the stage. It looks like the OS is taking over or something
      when you're selecting text on a text sprite. Is there any easy way around
      this? Or should I just try and keep editable text sprites from being used
      on the same frame as time-sensitive code? I'm thinking I could maybe get
      around it by making the sprite non-editable and changing the text manually
      based on keypresses, but that sounds like a lot of work to basically
      reinvent the wheel here for something that should just work, you know?


        • 1. Re: Frame rate goes crazy with editable text sprite
          Level 7
          Yep, nasty issue. Fixed with D11, presumably because text display has
          been divorced from the OS. Nothing you can do about it other than not
          rely on rate sensitive code while the mouse is held down on an editable
          text sprite. Perhaps you could try a Flash textInput instead.
          • 2. Re: Frame rate goes crazy with editable text sprite
            Level 7
            > Yep, nasty issue. Fixed with D11, presumably because text display has been
            > divorced from the OS. Nothing you can do about it other than not rely on
            > rate sensitive code while the mouse is held down on an editable text
            > sprite. Perhaps you could try a Flash textInput instead.

            Hmm. I was afraid of that. While I'm thinking about it - does D11 also fix
            the issue where if you set the stage drawRect to be the size of the desktop,
            all of the text displays incorrectly? That's another really annoying one
            that I can't think of a way to work around, short of replacing ALL text
            objects with just graphics that look like text or something - and my god
            that would be a pain to code, especially for dynamic text that needs to
            change regularly.

            (I'm not very confident of FlashComponents' abilities to handle this well -
            I already know that the FlashComponent buttons all display the text wrong,
            in addition to their other annoyances, such as blocking all keyboard input
            from affecting other sprites on the stage, not redrawing properly on frame
            changes, and otherwise just being a real pain to code unless you're a Flash
            expert, since there's almost zero documentation on them in the Director help
            files.)


            • 3. Re: Frame rate goes crazy with editable text sprite
              Level 7
              > does D11 also fix
              > the issue where if you set the stage drawRect to be the size of the desktop,
              > all of the text displays incorrectly?

              If "incorrectly" you mean scaled up to match the altered drawRect, then
              I expect so (though I haven't specifically tested it) since that's what
              the drawRect is intended to do
              • 4. Re: Frame rate goes crazy with editable text sprite
                Production Monkey Level 3
                "I have a lot of things that depend on a steady,
                predictable frame rate. "

                Bad idea.

                The Tempo channel sets the Maximum frame rate, but it could be much less and throw things out of sync. Depends on what you are doing.

                You can use Timeout objects to do time-based animations and completely forget about what the frame rate is. This is a far more robust solution across varying computer systems.

                Personally I have not used an "enterframe" or "exitframe" in over half a decade other than a single obligatory "go the frame" behavior.
                • 5. Re: Frame rate goes crazy with editable text sprite
                  Level 7
                  >> does D11 also fix the issue where if you set the stage drawRect to be the
                  >> size of the desktop, all of the text displays incorrectly?
                  >
                  > If "incorrectly" you mean scaled up to match the altered drawRect, then I
                  > expect so (though I haven't specifically tested it) since that's what the
                  > drawRect is intended to do

                  No, actually, what happens is the text DOESN'T scale up, and displays at
                  non-scaled size. This causes things to not line up where they're supposed
                  to be and generally wrecks the alignment of everything. Also, the
                  line-spacing seems to use the non-scaled values as well, so my carefully
                  lined up rows don't line up anymore when the movie is scaled. Tabs seem to
                  also be mis-aligned in some cases. Pretty much unless I make each word its
                  own individual text sprite+member, the text never aligns properly in scaled
                  up drawRects. It's truly annoying, and a pretty serious bug, I'd say.


                  • 6. Re: Frame rate goes crazy with editable text sprite
                    Level 7
                    > Bad idea.
                    >
                    > The Tempo channel sets the Maximum frame rate, but it could be much less
                    > and
                    > throw things out of sync. Depends on what you are doing.
                    >
                    > You can use Timeout objects to do time-based animations and completely
                    > forget
                    > about what the frame rate is. This is a far more robust solution across
                    > varying
                    > computer systems.
                    >
                    > Personally I have not used an "enterframe" or "exitframe" in over half a
                    > decade other than a single obligatory "go the frame" behavior.

                    Well, what I do is something like:

                    global timeBase
                    on exitFrame
                    if the ticks - timeBase > 2 then
                    repeat while the ticks - timeBase > 2
                    timeBase = timeBase + 2
                    gameLoop()
                    end repeat
                    end if
                    end

                    So, even if the movie is lagging behind, the gameLoop() executes at regular
                    intervals. If more than 2 ticks have passed between this frame and the
                    previous, it will execute the gameLoop() script multiple times in order to
                    catch up. All the important time-dependant stuff runs in gameLoop().

                    This is not what the problem is, however. Most of my animations on screen
                    are being shown as Film Loop sprites or in some cases animated GIFs, and
                    these are what depend on the steady frameRate. If you click on an editable
                    text object, the animations all suddenly speed up until you release the
                    mouse button. I guess it's really more of an aesthetic thing than anything
                    else, but it just looks really silly when everything suddenly runs
                    super-fast just because you clicked on a text sprite.