10 Replies Latest reply on Jan 3, 2008 12:21 PM by kglad

    Frame rate on ei/ff different

    kMon1234
      This is a new one for me. Generally, I thought frame rate was supposed to be the exact same on different browsers. Does anyone have any ideas?
        • 1. Re: Frame rate on ei/ff different
          kMon1234 Level 1
          Oops, I need to clarify. It looks like it's the setInterval that is being called at a different rate. That doesn't even make any sense. The other thing that doesn't make any sense is that when I change the frame rate, this effects the time between intervals... I mean, it's based on time, not on frame rate, right? That was always my understanding.
          • 2. Re: Frame rate on ei/ff different
            kglad Adobe Community Professional & MVP
            setInterval() will execute close to the rate set in its interval parameter. there will be some differences depending on the host machine's performance.
            • 3. Re: Frame rate on ei/ff different
              kMon1234 Level 1
              I have to disagree. I ended up changing the number in milliseconds of when it is called, they still are different though. Here was another person's catch of the same bug:

              http://www.thescripts.com/forum/thread715447.html
              • 4. Re: Frame rate on ei/ff different
                kglad Adobe Community Professional & MVP
                if that person's really using javascript, that's no bug: that's someone using an interval parameter that's impossible for any host machine to maintain.
                • 5. Re: Frame rate on ei/ff different
                  kMon1234 Level 1
                  I didn't realize that, but I wasn't using Javascript, just actionscript. Is the following code too much for any host machine to handle as well?

                  /////////////////////////////////// SCROLL FUNCTIONS
                  function scrollForward() {
                  //if (messages_container_mc._x<Number(messages_container_mc._width-210)*Number(-1) || currentMessageCounter == totalMessages) {
                  if (messages_container_mc._x<=Number(messages_container_mc._width-210)*Number(-1)) {
                  reachedTheLastMessage();
                  } else {
                  if (messages_container_mc._x<=newPosition) {
                  messages_container_mc._x = newPosition;
                  getNewXposition();
                  currentMessageCounter++;
                  from_txt.text = "From: "+dynamicTextFieldArray[currentMessageCounter].from;
                  }
                  messages_container_mc._x -= 5;
                  }
                  }
                  function scrollBack() {
                  restart = false;
                  if (messages_container_mc._x>10) {
                  clearInterval(intervalId1);
                  deActivateBack();
                  messages_container_mc._x = 10;
                  previousPosition = 10;
                  currentMessageCounter = 0;
                  from_txt.text = "From: "+dynamicTextFieldArray[currentMessageCounter].from;
                  } else {
                  if (messages_container_mc._x>=newPosition) {
                  messages_container_mc._x = newPosition;
                  getNewXposition();
                  currentMessageCounter--;
                  from_txt.text = "From: "+dynamicTextFieldArray[currentMessageCounter].from;
                  }
                  messages_container_mc._x += 5;
                  }
                  }
                  function snapFunction() {
                  if (whichDirection == "forward") {
                  if (messages_container_mc._x<newPosition) {
                  messages_container_mc._x = previousPosition;
                  } else {
                  previousPosition = newPosition;
                  intervalId1 = setInterval(this, "snapScrollForward", 30);
                  }
                  } else if (whichDirection == "backward") {
                  if (messages_container_mc._x>newPosition) {
                  messages_container_mc._x = previousPosition;
                  } else {
                  previousPosition = newPosition;
                  intervalId1 = setInterval(this, "snapScrollBack", 30);
                  if (newPosition == 10) {
                  deActivateBack();
                  }
                  }
                  }
                  }
                  function snapScrollBack() {
                  if (messages_container_mc._x>=newPosition) {
                  messages_container_mc._x = newPosition;
                  clearInterval(intervalId1);
                  currentMessageCounter--;
                  } else {
                  messages_container_mc._x += 5;
                  }
                  }
                  function snapScrollForward() {
                  if (messages_container_mc._x<=newPosition) {
                  messages_container_mc._x = newPosition;
                  //if (messages_container_mc._x<Number(messages_container_mc._width-210)*Number(-1) || currentMessageCounter == totalMessages) {
                  if (messages_container_mc._x<=Number(messages_container_mc._width-210)*Number(-1)) {
                  reachedTheLastMessage();
                  }
                  clearInterval(intervalId1);
                  } else {
                  messages_container_mc._x -= 5;
                  }
                  }
                  // SCROLL INTERVALS
                  function createForwardInterval() {
                  clearInterval(intervalId1);
                  intervalId1 = setInterval(this, "scrollForward", 30);
                  }
                  function createBackwardInterval() {
                  clearInterval(intervalId1);
                  intervalId1 = setInterval(this, "scrollBack", 30);
                  }
                  autoScroll_btn.onRelease = function() {
                  if (messages_container_mc._x<=Number(messages_container_mc._width-210)*Number(-1) || currentMessageCounter == totalMessages) {
                  restart = true;
                  }
                  activateFauxButtons();
                  clearInterval(intervalId1);
                  resumeAutoScroll();
                  deActivateAutoScrollButton();
                  };
                  • 6. Re: Frame rate on ei/ff different
                    kglad Adobe Community Professional & MVP
                    it depends what's on-stage, but it's probable that most computers could not handle that rate if everything on-stage is changing every 30 ms.

                    in addition, unless your frame rate is greater than 33, you should be using updateAfterEvent() in your called functions or, even if only a small number of display items are updating, you won't see updates as frequently as every 30 ms.

                    what is your framerate? if it's the default 12, you're only going to see the results of about every 3rd setInterval call.

                    after re-reading your first message, it appears you have a framerate that's too low for the interval frequency and you've failed to use updateAfterEvent(). you may be able to resolve your problem simply by using updateAfterEvent() in all your called functions.
                    • 7. Re: Frame rate on ei/ff different
                      kMon1234 Level 1
                      great, thanks a bunch for the info. It had initially been 40fps, so I'll change back and look into updateAfterEvent() . I've never used that function before, but I'm sure it will be easy enough to pick up.
                      • 8. Re: Frame rate on ei/ff different
                        kglad Adobe Community Professional & MVP
                        you're welcome.

                        there's not much to updateAfterEvent(). just place it inside any function that's called more frequently than the frame rate and updates stage appearance. normally, the stage is updated with each onEnterFrame loop. using updateAfterEvent() allows you to update more frequently.
                        • 9. Re: Frame rate on ei/ff different
                          kMon1234 Level 1
                          That works beauteously, thanks again!!! You rock!
                          • 10. Re: Frame rate on ei/ff different
                            kglad Adobe Community Professional & MVP
                            you're welcome.