1 Reply Latest reply on May 7, 2012 10:11 PM by Rothrock

    How do I detect the Previous Frame in a if/then statement?

    Mr. Baker the Shoe Maker Level 1

      I am attempting to instill certain conditions based on where the play head has been. In the code below, I would like to check if the previous frame was frame 6. If so, then something should happen. I get an error saying "Target of assignment must be a reference value."


      //Check certain conditions and adds the appropriate movie clip.

      if (prevFrame() = "6")



          page4_xText_2.x = 223;

          page4_xText_2.y = 51;

          bnt_forwardPage_5b.visible = true;

          bnt_backPage_5b.visible = true;





          page4_xText_1.x = 203;

          page4_xText_1.y = 103;

          bnt_forwardPage_5.visible = true;

          bnt_backPage_5.visible = true;




      Any suggestions?

        • 1. Re: How do I detect the Previous Frame in a if/then statement?
          Rothrock Level 5

          You have a lot of problems there.


          That specific error is because you are tyring to assign the string "6" to a function called prevFrame(). What you want inside of if statements is the comparison operator == not the asignment operator =.


          BUT that won't fix your problem either. prevFrame() isn't what you think it is. It is a method (function) of the MovieClip class that tells the playhead to goto the previous frame. If your movie is playing normally, then all you need to know is




          If your movie is playing in some kind of random order then you will need to make a way of keeping track of which frames and then use that technique to know. There is no built in way of knowing which frame was played before the current frame.


          Or, when you get to frame six you could tell flash to wait one more frame and then do something.


          Whatever it is that you are actually trying to do, there is probably a different and easier way to do it.