1 Reply Latest reply on Sep 28, 2009 1:20 PM by Ned Murphy

    gotoAndPlay(frame#); not working?

    pollopesca Level 1


      I’ve got a simple button that when clicked needs to go to a particular frame and stop when it hits the stop(); however when I test it I get a type error #1009 Cannot access a property or method of a null object reference. at PostCard_fla::MainTimeline/frame25()


      I need to be able to tell it what frames to go to manually so the user can jump around the time line using short animated transitions between pages (set up like a web page) in AC2.0 this was easy, but its different in AC3 and I’m not quite sure what I’m doing wrong.


      This is my code:



      btn_flip.addEventListener(MouseEvent.CLICK, buttonClick);

      function buttonClick(event:MouseEvent):void{



        • 1. Re: gotoAndPlay(frame#); not working?
          Ned Murphy Adobe Community Professional & MVP

          If you are certain that code is the source of the problem, then it probably means your btn_flip is the culprit since it is the only object being referenced.


          In order for that event listener to be assigned to the button, the button has to be present when the code executes.  So if that code is somewhere down the timeline form the button, the button doesn't exist when it executes.  Another possibility is that you have not given the button the instance name "btn_flip" in the properties panel.


          Also, if that button happens to transition in, and the first frames of it do not have the instance name assigned, that lack of an instance name gets inherited by the subsequent keyframe instances, even if you named them at the later keyframes.