• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

probleme copying XML: nodes please help

Explorer ,
Dec 19, 2009 Dec 19, 2009

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>

TOPICS
ActionScript

Views

437

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Dec 19, 2009 Dec 19, 2009

Pages.page.appendChild(templist)

thsi will append it as you wish

Votes

Translate

Translate
Guest
Dec 19, 2009 Dec 19, 2009

Copy link to clipboard

Copied

Pages.page.appendChild(templist)

thsi will append it as you wish

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 19, 2009 Dec 19, 2009

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 19, 2009 Dec 19, 2009

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2009 Dec 19, 2009

Copy link to clipboard

Copied

LATEST

lol no problem.

Happy Holidays


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines