0 Replies Latest reply on Nov 7, 2006 3:50 PM by redshark

    creating childnodes vars

    redshark
      Hello all

      I have been passed a project that integrates XML with flash and as I only have a limited knowledge of using XML I wondered if anyone could offer some help on this question.

      if you go to this link it shows how the file works and looks now which should help in my explanation. At the top of the map there are next and previous buttons which take you to different "divisions/ladders". These divisions are set as the first childNode and within these are the different bits of information that is shown at the bottom of the map (map name, clan name, next match etc).

      Now, the countries are set up as buttons so the information is shown as you roll over each of them and this is where the problem arises. If a new division is added then I will have to go through each country (40+ and counting) and then change each mention of the "division" childNode 10 times within each button. I wondered if it was possible to set up this first childNode as a variable that would only need to be changed once for the whole of a new division rather than 400+ times.

      An example is the following:

      on (rollover) {
      country=sd.childNodes[0].childNodes[8].childNodes[0].firstChild;
      clan=sd.childNodes[0].childNodes[8].childNodes[2].firstChild;
      field3=sd.childNodes[0].childNodes[8].childNodes[3].firstChild;
      field4=sd.childNodes[0].childNodes[8].childNodes[4].firstChild;
      field5=sd.childNodes[0].childNodes[8].childNodes[5].firstChild;
      field7=sd.childNodes[0].childNodes[8].childNodes[7].firstChild;
      field8=sd.childNodes[0].childNodes[8].childNodes[8].firstChild;
      field9=sd.childNodes[0].childNodes[8].childNodes[9].firstChild;
      field10=sd.childNodes[0].childNodes[8].childNodes[10].firstChild;
      mapImage.loadMovie(" http://www.eurodomination.co.uk/cod2/images/maps/mp_leningrad_small.jpg");
      }

      As you can see this is one button's rollOver state so to clarify is there a way to make a var that will get rid of the first childNode as that is the only one that would change when a new "division" is created and make a variable that says whenever the player is at a certain frame/label/scene that it would know that it is part of "division1" (childNodes[0]).

      I hope this makes some sense but if not please let me know and I'll try to clarify as much as possible. I just hope there may be some solution that will save me many hours and neaten up the coding.

      Thanks in advance
      James