You want to use brackets not braces and use the name () method. for each (var a : XML in [EMAIL PROTECTED]) { [EMAIL PROTECTED] ()] = a; }
--- In flexcoders@yahoogroups.com, "pgp.coppens" <[EMAIL PROTECTED]> wrote: > > Hello, > > I would like to copy a number of attributes from one element to a second > element, but I can't find a way to achieve it > > To set the scene, something like > > var x1:XML = <x1 a1='a1' a2='a2'/>; > var x2:XML=<x2/>; > > for each (var a:XML in [EMAIL PROTECTED]) { > [EMAIL PROTECTED] = a; > } > Obviously the code above does not work, and in the situation I would > need it, the input elements and attributes are not known at compile > time. > > Does anyone know if it is possible in a generic way to copy attributes > from a first element to a second using E4X and how to do it? > > Thanks! > > Peter