To illustrate my question. Assume the following code snippet:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![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() + "]");
}
]]>
</mx:Script>
<mx:Button label="Create Button" click="createButton()" />
<mx:VBox id="btncontainer" />
</mx:Application>
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:
New Button Created [main0.btncontainer.Button15]
New Button Created [main0.btncontainer.Button19]
New Button Created [main0.btncontainer.Button23]
New Button Created [main0.btncontainer.Button27]
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?
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?