Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7784481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:06:07+00:00 2026-06-01T20:06:07+00:00

I am making a simple debugger window in ActionScript for myself where I can

  • 0

I am making a simple debugger window in ActionScript for myself where I can add and remove variables I want to track. I was to be able to add variables to the list by just doing something like

DebuggerMonitor.trackVar(variable).

My question is, is there any way I can turn “variable” itself (the name, not the value) into a String to be added into a text field?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:06:07+00:00Added an answer on June 1, 2026 at 8:06 pm

    Depending on how “intelligent” your debugger should be, you could just pass the name along:

    DebuggerMonitor.trackVar( variable, "variable" );  
    

    since obviously, when used in a context like this, the name should be known at the time you are writing the program.

    You can also do some reflection magic to get instance variable names, but it won’t work for temp variables (their names are dropped at compilation time):

    public function getVariableName( instance:*, match:* ):String {
        var typeDescription:XML = describeType( instance );
        var variables:XMLList = typeDescription..variable;
        var accessors:XMLList = typeDescription..accessor;
        for each(var variable:XML in variables) 
            if(matchesXMLName( instance, variable, match )) 
                return variable.@name;
        for each(var accessor:XML in accessors) 
            if(matchesXMLName( instance, accessor, match )) 
                return accessor.@name;
        return "No name found.";
    }
    
    private function matchesXMLName( instance:*, xml:XML, match:* ):Boolean {
        return match == instance[xml.@name.toString()];
    }
    
    var varName:String = getVariableName ( myObject, variable );
    

    Using reflections like this will also be quite costly, if used often – you will have to think of a way to cache the type descriptions.

    I recommend you check out the as3commons reflections package – there is a lot of useful functionality in there…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was making a simple class for a small project and decided to just
I'm making a simple Image Debugger Visualizer. Code is below. I'm not sure if
I'm making a very simple turn based battle game using ActionScript 2.0. I'm VERY
I am making simple WinForm application and I want to ask what is best
I'm making simple paint program, and in that program users are able to save
guys, I'm making simple graph drawer and want to find beautiful values for horizontal
I am making simple connection between two table - first one called users has
Im making a simple alternative to the default linux system monitor. Im looking to
in making a simple cgi server for a course. To do that in some
I’m making a simple LOB app which loads data from an XML file and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.