5 Replies Latest reply on Oct 1, 2010 8:17 AM by kglad

    Actions in Frame 2

    Radu Cristian Dimitrie Level 1

      1. Can i put another set of actions in frame 2 of the actions layer?

      i tested but it doesn't seem to work..

      it has 836 rows of code and it's getting annoying when tryin to search for a function..

       

      2. I am not that familiar with classes, i usually put all the code into movieclips or in actions layer.. i am not sure if i can call a function from a actionscript class..

       

      3.I am curios if there is any way i could specify an alternative for the if statement like in this pseudocode:

       

      if ( apple is not clean BUT is tasty)

      {

           eat(apple)

      }

        • 1. Re: Actions in Frame 2
          kglad Adobe Community Professional & MVP

          1.  yes.  that code won't execute until frame 2 plays but once frame 2 plays, the code will be in-effect.

           

          2.  yes, you can call a function from a class.  the class will need access to the class that contains the function.

           

          3.  probably yes.  the while() function can be coerced to do what an if-statement does but why do you want an alternative?  you should use coding that's easiest for you to follow and understand.

          • 2. Re: Actions in Frame 2
            Radu Cristian Dimitrie Level 1

            3.it's a A* pathfinding algorithm that checks if tile is accesible.. start tile and end tile are not accessible because the soldier sits on that tile..

            i want to write something like this:

             

            if (tile is accessible OR is start tile/end tile) // is not accesible BUT is the start tile or end tile

            }

                 push to array

            {

             

            [ 1 ][ 2 ][ 3 ][ 4 ]

             

            1 is the start tile and 4 the end tile..

            the algorithm computes all neighbours for each tile and selects from all neighbours the shortest to the end tile..

            problem is, when reached tile 2 and computes neighbour 1 OR reached tile 3 and computes tile 4, it will not know that 1 or 4 are the start/end tiles, just that they are not accessible and will not be pushed to array..

             

            1. can i gather data from frame 2 code into frame 1?

            i don't want to change the frame..

            • 3. Re: Actions in Frame 2
              kglad Adobe Community Professional & MVP

              once frame 2 executes it can access any code in frame 1 (that wasn't over-written with frame 2 code).

              1 person found this helpful
              • 4. Re: Actions in Frame 2
                Radu Cristian Dimitrie Level 1

                so if i have action code over multiple frames, i simply put stop() at end frame, and make the calls from there?

                • 5. Re: Actions in Frame 2
                  kglad Adobe Community Professional & MVP

                  a stop(), as far as actionscript is concerned, only affects frames beyond the one with the stop().

                   

                  once the frame containing code plays, it's indistinguishable from code that was in any other frame that's also played.  the only exception is duplicate function/methods that overwrite an identical one.

                  1 person found this helpful