Hi everyone,
This code does not work beside does not occur error:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="appComplete()">
<mx:Script>
<![CDATA[
private var xml:XML =
<menu>
<item>burger</item>
<products></products>
</menu>;
private function appComplete():void{
xml[1].appendChild(<product>ball</product>);
}
]]>
</mx:Script>
</mx:Application>
What I want to do is adding "product" node in "products" node in XML.
Thanks.
I found the problem, is:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
private var xml:XML =
<menu>
<item>burger</item>
<products></products>
</menu>;
private function btn1_click():void{
xml.products[0].appendChild(<product type="aaa"/>);
}
]]>
</mx:Script>
<mx:Button x="115" y="73" label="Button" click="btn1_click()"/>
</mx:Application>
North America
Europe, Middle East and Africa
Asia Pacific