A more succinct way to ask this question is: does anyone know how to bind a new element to an existing namespace?
See error #1083 here: http://livedocs.macromedia.com/labs/as3preview/langref/runtimeErrors. html ~harris --- In [email protected], "Harris Reynolds" <[EMAIL PROTECTED]> wrote: > > Anyone have a clue how to dynamically (using ActionScript) add a > child element to an XML document that is in a namespace that is > already declared? > > Below is a simple example that shows what I'd like to do, but is > broken. This should be so simple, but I am getting an error saying > the element isn't bound to the namespace. > > thanks, > > ~harris > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" creationComplete="onCreationComplete()" > > <mx:Script> > <![CDATA[ > import mx.controls.Alert; > > public function onCreationComplete():void > { > > var xml:XML = <mx:Application > xmlns:mx='http://www.adobe.com/2006/mxml' layout='absolute'> > </mx:Application>; > var ns:Namespace = xml.namespace("mx"); > var dynamicElement:XML = <mx:DynamicNameHere > width='100%' height='100%'></mx:DynamicNameHere> > dynamicElement.setNamespace(ns); > xml.appendChild(dynamicElement); > > Alert.show("XML Message:\n" + xml.toXMLString > (), "Test"); > } > ]]> > </mx:Script> > </mx:Application> >

