Copy the text of a sprite into another sprite

Hi!!
I have this small project . I want, when clicking on the sprite with text, this text is moved into the sprite without text from left to right.
Sorry for my english

A quick hack to make your code work:

for (i in 0...tabConcat.length) 
        {
            var sp:Sprite = new Sprite();
            txt1 = new TextField();
            
            sp.graphics.beginFill    (0xD006ff, 0.5);
            sp.graphics.drawRect    (0, 0, 30, 30);
            sp.x = i * 30 + 120 + i * 2; 
            sp.y = Main.maxHeight - 75;
            
            txt1.visible = true; 
            txt1.selectable    = false; 
            txt1.width     = 30;    
            txt1.height = 30;
            txt1.autoSize = TextFieldAutoSize.CENTER;
            txt1.textColor = 0xfcc0fc;
            txt1.text = tabConcat[i];
            sp.addChild    (txt1);
            addChild(sp);
            
            sp.addEventListener(MouseEvent.CLICK, function (e)
            {
                sp.visible     = false;
                var txt = new TextField();
                txt.text     = tabConcat[i];
                tabCombinaisonUser.push(txt.text);
                var len:Int = _tabCombinaisonUser.length;
                for(k in 0...len)
                {
                    var index:Int = len - 1 - k;
                    if(_tabCombinaisonUser[index].numChildren > 0)
                    {
                        if(index < len - 1)
                        {
                            _tabCombinaisonUser[index+1].addChild(_tabCombinaisonUser[index].getChildAt(0));
                        }
                        else
                        {
                            _tabCombinaisonUser[index].removeChild(
                                    _tabCombinaisonUser[index].getChildAt(0));
                        }
                    }
                }
                _tabCombinaisonUser[0].addChild(txt);
            });
        }

I don’t know how big your project is, but if your project grows a little bit it will certainly become a maintenance hell. You should check how scopes work with Haxe and play a little bit more with the language itself before starting an OpenFL project:

Any doubts, just ask! =)

Thanks @fabiopicchi
Sincerely, I’m starting in Haxe. I had to read the documentation haxe but I tell myself that I must get into concrete projects to encounter obstacles and can, if necessary there, returning occasionally to theory.

As for my project, I try to reproduce this Android Game With modifications With regard to the language.

As you can see in the game that I sent you, your algorithm does not work exactly the way I want