A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Clearing All _root.variables

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    105
    Anyone know of an easy way to clear all variable values in a certain level or just all of them?

  2. #2
    avatar free
    Join Date
    Jul 2002
    Location
    UK
    Posts
    835
    Use this code to set all variables in _root (or whereever, MC, object etc) to 0 (again, or to whatever, true false etc)...

    Code:
    for (varname in _root)
    {
    _root[varname] = 0;
    }

  3. #3
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Or:

    varname delete;

    But that is not a single function that deletes all

  4. #4
    avatar free
    Join Date
    Jul 2002
    Location
    UK
    Posts
    835
    I thought it was the other way around...

    delete varname;

    And you can combine the 2 can't you? Unless this deletes more than you need (like the version number) - will that have side effects?

    for (varname in _root)
    {
    delete varname;
    }

    So maybe it's wise to contain the required wiped variables in a seperate object/MC to not delete version number...?

  5. #5
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Yes, it is suppose to be delete varname. I never used it, just remember reading it once

  6. #6
    Senior Member
    Join Date
    Jan 2001
    Posts
    105
    Thanks folks.

    Haven't had a chance to test it out yet...but I will.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center