A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS2 swap values from XML input

  1. #1
    Member
    Join Date
    Feb 2005
    Posts
    81

    AS2 swap values from XML input

    Hello all,
    I have the following scenario: I'm loading data values from an external XML file and I want to swap them with other ones in order to show the latter further on in the movie. As an example, I have the following data in the XML file:

    Code:
    <set label='Epson'>
    <set label='Hitachi'>
    <set label='Toshiba'>
    <set label='Mitsui'>
    <set label='Panasonic'>
    <set label='Canon'>
    <set label='Lexmark'>
    and I want to swap the following data
    if it's "Epson" swap with "EPS994"
    if it's "Hitachi" swap with "HIT330"
    if it's "Toshiba" swap with "TOS924"
    if it's "Mitsui" swap with "MIT552"
    if it's "Panasonic" swap with "PAN882"
    if it's "Canon" swap with "CAN113"
    if it's "Lexmark" swap with "LEX710"

    They will appear in a random order but only once in each graph. In essence, I need something that takes the XML label attribute and swaps it with an other value before sending it further on to the rest of the movie for processing. It would be more practical to do the swapping in the server app that writes the xml file before it is written but that is not possible so I need to do that search and replace when I load the xml in Flash...

    Is that possible? Thanks!

    Edit: I could use even something like open the xml - search and replace values - save to new xml
    Last edited by mx_green; 05-14-2010 at 11:37 AM.

  2. #2
    Member
    Join Date
    Feb 2005
    Posts
    81
    Nevermind, managed to make it with a switch statement and it works fine now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center