title: Component names and ids in Flex and Actionscript, where do they come from?
body: <p>To illustrate my question. Assume the following code snippet:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&gt;
  
  &lt;mx:Script&gt;
      &lt;![CDATA[
          import mx.controls.Button;
  
          private function createButton():void
          {
              var myButton:Button = new Button();
              myButton.label = "Foo";
              this.btncontainer.addChild(myButton);
              trace ("New Button Created [" + myButton.toString() + "]"); 
          }       
      ]]&gt;
  &lt;/mx:Script&gt;
  
  &lt;mx:Button label="Create Button" click="createButton()" /&gt;
  &lt;mx:VBox id="btncontainer" /&gt;
  
  &lt;/mx:Application&gt;
  </code></pre>
  
  <p>The behavior of this script should be obvious. Each click of the "Create Button" button will generate a new button with a label of "Foo". What the code does and why it does it makes sense to me. My question is about the console output. When I run the app in debug mode and click the "Create Button" four times I get the following in my console:</p>
  
  <pre><code>New Button Created [main0.btncontainer.Button15]
  New Button Created [main0.btncontainer.Button19]
  New Button Created [main0.btncontainer.Button23]
  New Button Created [main0.btncontainer.Button27]
  </code></pre>
  
  <p>My question is where does the number appended to the object name come from? e.g. Button15, 19, 23, 27... etc? Is there some sort of array in the background that holds the objects and is this an index value? Is it some sort of internal counter? Is this a pointer value of some kind? In my tests, at least, why does it seem to always follow the same pattern 15, 19, 23, 27... separated by 4 each time in this case?</p>
  
  <p>I understand conceptually what is happening here. A new Button object is spawned and allocated memory. Each time I click "Create Button" I am creating a new instance of the Button class and adding it as a child to the VBox object. I was just curious what is the meaning or significance of the numbers appended to the objects as they are created?</p>