Skip to main content
Inspiring
June 23, 2009
Question

can I use the debugger to identify items on stage?

  • June 23, 2009
  • 1 reply
  • 323 views

Hi all,

I have an app that uses several Loader objects to load extenral swf files.  Things go well except for one point.  I have a quiz element that's loaded through a loader named 'quiz'.  When the quiz is done, I remove the quiz element with removeChild(quiz).  The quiz disappears from the screen every time except for one question.  I can't identify what's going on differently for that question.  I've debugged this and can see that my quiz object is set to null, but I can plainly see the quiz still onscreen.

To further confuse me, I use the same loader object multiple times through the app, and just add it and remove it from the display list with addChild and removeChild.  When my one problem question comes up and fails to go away, the app continues to the next question, and I can see that there are now 2 quiz objects stacked on top of each other.  I have no idea how this can happen when I'm using the same loader object for all the questions.

Anyway, I'm hoping I can use the variables in the debugger to identify what I'm seeing onstage, but am not sure where to start looking.  Are all dispaly objects that are children of the app within the stage in the debugger variables?  The root?  I'm just not sure where to look.  If someone can tell me where to find the display objects on the stage or whatever in the debugger variables, that would be great and I can hopefully troubleshoot it from there.

This topic has been closed for replies.

1 reply

Inspiring
June 23, 2009

here's some code that might help . . . they're really pretty simple.

Here are the 2 main methods that handles loading and unloading the quiz.

        public function put_question():void{ // BUILD LOADER TO LOAD QUIZ SWF
            quiz = new Loader(); // QUIZ IS A CLASS VARIABLE
            addChild(quiz);
            quiz.load(new URLRequest("quiz.swf"));
        }

        public function quiz_done():void{
            removeChild(quiz);

            ethics_content.nextScene(); // ETHICS_CONTENT IS A CLASS VAR LOADER THAT WAS ADDED TO THE STAGE
        }

put_question is called from the timeline at the end of an animation.  The method executes and puts the quiz.  The quiz_done method is run when the user selects the right anwser, reads some feedback, then clicks to continue.

I have 5 scenes before the problem point that use these methods and the work great.  The quiz appears, works fine, then disappears when the quiz_done function is called.  In the last scene, though, the quiz just doesn't disappear when the quiz_done function runs!

I'm hoping I can find a way to use the debugger to set a break point at the end of the quiz_done method and then go through the display list and see what it is I'm still seeing, as the quiz should be removed from the display list at that point.