12 Replies Latest reply on May 24, 2007 4:12 PM by Rothrock

    AS3 How to Use Debugger

    Rothrock Level 5
      With AS3 two things have changed that is making it really hard for me to make any progress with learning what is going on. If anybody has suggestions, please pass them along.

      Under AS2, when I had questions about if a varaible, function, object, etc. was properly defined, loaded, in the scope I thought, assigned, etc. I would go test movie and then go to the debug menu and choose list variables or list objects. I could then search through that and find bits and pieces. It was quick it was easy and it met my needs. This has gone away in AS3. The list variables menu item is still there, but it doesn't list anything.

      Another AS2 trick was to use a for…in loop to look through what an object or event to see what was in it. Again a quick way to find out what was actually in that event/object and what it was called. This has also gone away, for in loops don't seem to iterate over anything.

      It was suggested to me that I use the debugger. But I'm lost with it.

      As the first step to learning about ByteArray I've set up a little loader. But when I use the debugger – which seems to have plenty of its own – I get soooooo many things and pages and pages of information that I can't find the bits I'm interested in. This little test of code is almost nothing. I can't imagine how complex something fully developed will look like. There also doesn't appear to be a search/find function so I have to drill down. So is there any way to limit the debugger to just show the things I'm interested in?

      Also is there any quick way to see what the properties, etc. of an event (or other object) are? In the olden days, I would have been the first to say the help files. But for most things I've tried to look up I haven't a clue how to find. And it is often a long chase through super class, to super class.
        • 1. Re: AS3 How to Use Debugger
          kglad Adobe Community Professional & MVP
          i have to run but i'll respond with some of the things i've learned when i return. in the meantime to help with your immediate question about the event class, use its toString() method to enumerate some of its properties.

          under formatToString() there's an example of customizing the properties returned by the toString() method.
          • 2. Re: AS3 How to Use Debugger
            kglad Adobe Community Professional & MVP
            i'm learning too. and i never used the debugger/debug menu so i'm not able to comment on that.

            the trace() function still works and that's all i've ever used for debugging. you can still loop through objects using the for-in loop. because the displayobjects (including sprites and movieclips) inherit from the object class, you can still loop through them.

            the for-in loop won't display properites like x,y,alpha but it will iterate over user defined properties. the following works just like the good old days:

            • 3. Re: AS3 How to Use Debugger
              kglad Adobe Community Professional & MVP
              as for learning this stuff. after reading programming actionscript 3.0, it's best to start with the basic classes and work your way up the chain to more and more specialized classes. and object is a good place to start.

              because i find it boring to follow my own advice i actually jump back and forth from classes that catch my attention to classes that are up the inheritance chain.

              the object class has a setPropertyAsEnumerable() method that got me all excited. it looks like it should allow one to make non-dynamic properties available to for-in loops. but that doesn't work for some reason.
              • 4. Re: AS3 How to Use Debugger
                Rothrock Level 5
                Yeah, I'll keep plugging away to. Thanks for the tips.

                I would think you would work your way down the chain of classes, not up? :) From the way the doucmentation is made, it seems it would be better to start with Object, then work down to Loader. If you try and start with Loader you will never figure out all the things it inherits. That being said, I don't follow my own advice either and the Loader is something I really need!

                I'm getting Keith Peters book an animating with AS3. I'm hoping it will give me a lot of hands on experience.
                • 5. Re: AS3 How to Use Debugger
                  kglad Adobe Community Professional & MVP
                  you're correct. starting with the object class and working down is better phraseology than starting with the object class and working up.

                  i've found senocular's observations about as3 very helpful: http://www.kirupa.com/forum/showthread.php?t=223798

                  i zip through everyone else's comments except sen's. his are worthwhile.

                  i just decided to check out his website (senocular.com) after realizing how much i appreciated his comments on kirupa.com and that looks like a lot of great info, too.

                  and i read everything trevor mccauley posts here. he obviously knows his stuff ( http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html) and i find this forum is a great place to learn.
                  • 6. Re: AS3 How to Use Debugger
                    Rothrock Level 5
                    Yes, I've been reading along with that thread. It is VERY long and I do get glazed over sometimes. But the darn thing makes me want to try things and then see the results, but without having List Variables and the other issues, I just have a hard time sometimes. I'm sure it will come.

                    Thanks for all your help.
                    • 7. Re: AS3 How to Use Debugger
                      kglad Adobe Community Professional & MVP
                      p.s. i had no idea trevor was senocular.
                      • 8. Re: AS3 How to Use Debugger
                        Rothrock Level 5
                        Well at least your instincts about who know what are pretty accurate. :)
                        • 9. Re: AS3 How to Use Debugger
                          kglad Adobe Community Professional & MVP
                          that does show some consistancy.

                          i'm going through sen's tutorial ( http://www.senocular.com/flash/tutorials/as3withflashcs3/) now.

                          this is the 3rd (or more) time that i've read some of this stuff and it's really helping. i don't know if that tutorial is really great or it's just the 3rd time charm thing, but i suspect it's more the tutorial.
                          • 10. AS3 How to Use Debugger
                            Returning to Rothrock's original question about the debugger: I can't get the AS3 debugger to show any details. I've gone through the documentation and tried their so-called examples (they do mention that you need to select "permit debugging" in the publish settings), but I get nothing. Any hints...I'd rather get too much info than none at all.

                            Between this and the "Check Syntax" bug, I'm getting ready to go postal on Adobe (not really, but I am slightly miffed).
                            • 11. Re: AS3 How to Use Debugger
                              tanenbaumm Level 1
                              OK. I've had some success. It seems that in order to see anything in the AS3 debugger, one needs to set a breakpoint. Only when we stop at the BP do we get any feedback. Is that correct?

                              I can see how that's more processor-efficient, but I was used to being able to see live data updates, as in the AS2 debugger. There also seems to be no way to set a watch. Anyone know how to enable these things?
                              • 12. Re: AS3 How to Use Debugger
                                Rothrock Level 5
                                This would totally be the blind leading the blind. The more I try to use it the less I seem to be able to accomplish. Please post back if you figure out how to do these things.