savez vous comment faire pour dupliquer un élément ?
voici l'exemple :
CODE
<mx:Form width="100%" height="100%" id="form">
<mx:FormItem label="" id="foiSource" width="100%" borderStyle="solid">
<mx:TextInput id="txiSource" maxChars="70"/>
</mx:FormItem>
<mx:FormItem width="100%" label="Ajouter un titre" borderStyle="solid">
<mx:Label text="Titre"/>
<mx:TextInput/>
<mx:Label text="Pays"/>
<mx:TextInput/>
<mx:Button label="Ajouter titre personnalisé" click="ajoutTitre();"/>
</mx:FormItem>
</mx:Form>
<mx:FormItem label="" id="foiSource" width="100%" borderStyle="solid">
<mx:TextInput id="txiSource" maxChars="70"/>
</mx:FormItem>
<mx:FormItem width="100%" label="Ajouter un titre" borderStyle="solid">
<mx:Label text="Titre"/>
<mx:TextInput/>
<mx:Label text="Pays"/>
<mx:TextInput/>
<mx:Button label="Ajouter titre personnalisé" click="ajoutTitre();"/>
</mx:FormItem>
</mx:Form>
a chaque clique sur le bouton j'aimerais dupliquer le FormItem qui contient un TextInput et les replacer dans le Form.
j'ai essayé de faire ceci :
CODE
var foi:DisplayObject = form.getChildByName('foiSource');
form.addChildAt(foi, form.getChildIndex(foi));
form.addChildAt(foi, form.getChildIndex(foi));
mais j'ai l'erreur : L'index indiqué sort des limites.
vous avez une idée ?
merci