2 Replies Latest reply on Mar 24, 2011 9:12 AM by prip14

    setInterval() causing a typeError


      Hi im trying to make scrolling text appear on a few screens, so that when i click on a button to go to the next frame the characters of a sentence will appear one after another as if someone is talking. this works a few times however when i go back to the first frame the following error occurs and the text no longer appears??

      Can anyone help please!???


      TypeError: Error #1009: Cannot access a property or method of a null object reference.

                      at rollingtext_fla::MainTimeline/runthree()

                      at Function/http://adobe.com/AS3/2006/builtin::apply()

                      at SetIntervalTimer/onTimer()

                      at flash.utils::Timer/_timerDispatch()

                      at flash.utils::Timer/tick()



      this is my code basically the same for each new frame


      var talkinterval=setInterval(runone,60)
      var i:Number;

      function runone() {
      var text:String = "Restrictive signs come in red and blue circles.";


      b_next.addEventListener(MouseEvent.CLICK, nexts)
      function nexts(e:MouseEvent){



        • 1. Re: setInterval() causing a typeError
          Ned Murphy Adobe Community Professional & MVP

          This is an AS2 forum.  You should repost in the AS3 forum if you cannot resolve it with what I offer.


          Your error appears to pointing at something in the runthree function, so you may want to check whatever frame that is in to make sure all the instances involved exist and have names.


          The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
          - is not in the display list
          - doesn't have an instance name (or the instance name is mispelled)
          - does not exist in the frame where that code is trying to talk to it
          - is animated into place but is not assigned instance names in every keyframe for it
          - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
          If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

          • 2. Re: setInterval() causing a typeError
            prip14 Level 1

            thanks for your quick response,

            I check all objects and their instances are all named correctly.

            Function runthree is exactly the same as runone but with different instance names so i still don't know what could be causing the text to slow down.