Not sure how you want to come up with the names but, assuming you have
a name prepared that you'd like to provide at the time of button
click, you could try this.

        private var _namedCubesArray:Array = new Array;

        private function buildNewCube(cubeName:String):void
        {
                var thisCube:Cube = new Cube();
                thisCube.Name = cubeName;
                _namedCubesArray.push(thisCube);
        }

If it's the generation of names that is giving you grief, you could
set up a private variable - at the class level:

                private var _cubeNum:int = 0;
        private var _namedCubesArray:Array = new Array;

        private function buildNewCube():void
        {
                var thisCube:Cube = new Cube();
                thisCube.Name = CubeWithIndex + _cubeNum;
                _namedCubesArray.push(thisCube);
                _cubeNum++;
        }

On Jul 22, 7:51 am, le_unam <[email protected]> wrote:
> hey, i want to create some objects with dynamic names. so i have a
> button and on press it should create a cube. when i press again it
> should create another cube and so on. my problem is that i`m not able
> to create dynamic names. maybe i dont know the syntax but i tried this
> for many hours and it doesnt work. the different names are a must have
> because i want to change the position of them all seperately.
>
> greetz manu

Reply via email to