Use insertChildBefore( ) and insertChildAfter( ) to modify an XML tree
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var example:XML = <example/>;
example.two = "";
// Before the two element node, add a one element node
example = example.insertChildBefore( example.two, <one /> );
// After the two element node, add a three element node
example = example.insertChildAfter( example.two, <three /> );
trace( example );
}
}
}
Related examples in the same category