简体   繁体   中英

How to update/store changed XML Node value in Flash/AS2?

I've succesfully loaded and parsed this XML file, using XMLParser and AS2:

<Resources>
   <item author="Julian" date="28/12/2010" time="01:18" id="876" like="8" dislike="5">
      <Text>Sample paragraph</Text>
   </item>   
   <item author="Albert" date="28/12/2010" time="01:18" id="876" like="8" dislike="5">
      <Text>Sample paragraph 2</Text>
   </item>
   <item ...
</Resource>

Now, what I need, is to increase and store the "like" and "dislike" values with the click of a button, but I don't know how to modify and store them in the existing nodes (eg., without adding new ones).

Do I need to use PHP, or can AS2 handle it by itself?

Any help on the subject? Thankyou!

you will need php. I've found the easiest thing to do is update the values in actionscript (it has an internal copy of the xml), then push the xml to your php method to write it. If you have multiple users updating the same file, you may need to have some kind of check out service so the file isn't being overwritten. This would only happen if two users updated the like/dislike at the same time. You could do without it, but something to keep in mind. Another think to keep in mind is security. You don't want anyone else calling you php method to write to your server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM