Copy link to clipboard
Copied
hi here is my simple script:
i dont understand why my templist:XMLList doesnt work:
var Pages:XML=<Pages />;
Pages.page = <page />;
Pages.page.@id="5";
Pages.page.adverts=<adverts />;
Pages.page.adverts.adfile=<adfile />;
Pages.page.adverts.adwidth=<adwidth />;
Pages.page.adverts.adheight=<adheight />;
Pages.page.adverts.adposx=<adposx />;
Pages.page.adverts.adposy=<adposy />;
Pages.page.adverts.adfile="yoyo";
Pages.page.adverts.adwidth="2";
Pages.page.adverts.adheight="3";
Pages.page.adverts.adposx="6";
Pages.page.adverts.adposy="8";
var templist:XMLList= Pages.page.adverts.copy();
templist[0].adfile="yiyi";
templist[0].adwidth="56";
templist[0].adheight="568";
templist[0].adposx="1078";
templist[0].adposy="2005";
Pages.page.adverts.insertChildBefore(Pages.page.adverts, templist);
trace(Pages);
IT TRACE IN THE OUTPUT THIS
<Pages>
<page id="5">
<adverts>
<adfile>yoyo</adfile>
<adwidth>2</adwidth>
<adheight>3</adheight>
<adposx>6</adposx>
<adposy>8</adposy>
</adverts>
</page>
</Pages>
INSTEAD OF TRACING THAT :
<Pages>
<page id="5">
<adverts>
<adfile>yoyo</adfile>
<adwidth>2</adwidth>
<adheight>3</adheight>
<adposx>6</adposx>
<adposy>8</adposy>
</adverts>
<adverts>
<adfile>yiyi</adfile>
<adwidth>56</adwidth>
<adheight>568</adheight>
<adposx>1018</adposx>
<adposy>2005</adposy>
</adverts>
</page>
</Pages>
Pages.page.appendChild(templist)
thsi will append it as you wish
Copy link to clipboard
Copied
Pages.page.appendChild(templist)
thsi will append it as you wish
Copy link to clipboard
Copied
THANKS A LOT , i complicate to much.... sometime I even take a calculator for do 2+2..... thank and mery chrismas
Copy link to clipboard
Copied
The command you used would have placed it before the original entry if it were coded correctly...
Pages.page.insertChildBefore(Pages.page.adverts[0], templist);
Copy link to clipboard
Copied
lol no problem.
Happy Holidays