4 Replies Latest reply: Sep 7, 2012 1:52 PM by Ned Murphy RSS

    Question about action script 2




      I hope I posted in right forum.


      I used this code http://www.adobe.com/devnet/flash/articles/puzzle_game_sample.html to make my own puzzle and I made changes like image of puzzle and number and size of puzzle pieces and board. I also changed placement of pieces in the beginning to fit my puzzle better. Now everything is working fine, it recognizes piece is on the right place and all but once puzzle is solved it won't load disappearing effect and you have won part I added to go after it. I tried removing what I added to go after but it still didn't do disappearing effect. It acts as if puzzle isn't solved from what I can see but I can't figure out why.If someone could help me I would be very grateful. ^^



        • 1. Re: Question about action script 2
          SuhasYogin Adobe Employee

          Moving this thread out of the FAQs to Flash Pro - General forums.

          • 2. Re: Question about action script 2
            Ned Murphy MVP

            Can you show the code that is relevant to your problem(s)? (Not all of the code, just the relevant portions of it.)

            • 3. Re: Question about action script 2
              Kuglof Community Member

              I'll give you whole code cause I'm not sure what is wrong.




              And code I used is at link I posted.


              I assume problem could be at part I bolded since I added more pieces and changed size but it also maybe doesn't import the right info.



              • 4. Re: Question about action script 2
                Ned Murphy MVP

                That's too much code to look at.  It is better to just provide the code that is directly relevant to the problem, preferably in a form that is not page-based, and within the posting thread so that it is readily evident to see.


                The function that you highlighted appears to perform the work that you say works fine except for the part where the puzzleSolved(); get called.  I would expect the problem to either be the conditional you have that drives calling that function...


                     if(correctPuzzlePieces == totalPuzzlePieces) {




                or in the puzzleSolved function.  So what you should do to try to isolate the problem is use the trace() function to see what the values of things are or if certain processing is being executed.  For instance, see if the conditional works when it should by putting a trace before it and a trace within the puzzleSolved function...



                     trace(correctPuzzlePieces, totalPuzzlePieces);

                     if(correctPuzzlePieces == totalPuzzlePieces) {




                    function puzzleSolved():Void {

                        trace("this function has been called")


                Continue to use the trace to track down where things don't agree with what you expect they need to be.