flash - calling data from XML in SWF. -
so have make app upcoming euro 2012. it's going swf file witch going load data xml file. i've made everything, still have 1 big problem. here xml file:
<games> <game><startdate>2012-06-08 19:00:00</startdate> <minute><minute/> <team1>Полша</team1> <team2>Гърция</team2> <score1>0</score1> <score2>0</score2> <goals> <goals1></goals1> <goals2></goals2> </goals> </game> <game> <startdate>2012-06-08 19:00:00</startdate> <minute><minute/> <team1>Полша</team1> <team2>Гърция</team2> <score1>0</score1> <score2>0</score2> <goals> <goals1></goals1> <goals2></goals2> </goals> </game> . . . and have repeats 29 times.
here as2 witch loading first <game> node :
var my_xml = new xml(); my_xml.ignorewhite = true; my_xml.onload = onxmlloaded; function reloadxml(){ my_xml.load("direktno.xml"); } my_xml.load("direktno.xml"); function onxmlloaded() { _root.main.ma4.minute.text = my_xml.childnodes[0].childnodes[1].childnodes; _root.main.ma4.team1.text = my_xml.childnodes[0].childnodes[2].firstchild.nodevalue; loadmovie(getflag(_root.main.ma4.team1.text), _root.main.ma4.balls); _root.main.ma4.team2.text = my_xml.childnodes[0].childnodes[3].firstchild.nodevalue; loadmovie(getflag(_root.main.ma4.team2.text), _root.main.ma4.balls2); _root.main.ma4.score1.text = my_xml.childnodes[0].childnodes[4].firstchild; _root.main.ma4.score2.text = my_xml.childnodes[0].childnodes[5].firstchild; // end score // gol maistori team 1 if (my_xml.firstchild.childnodes[6].firstchild.childnodes[0].firstchild) { _root.main.ma4.minutegoal1.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[0].firstchild } else { _root.main.ma4.minutegoal1.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[0].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[1].firstchild) { _root.main.ma4.goalmaker1.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[1].firstchild; }else { _root.main.ma4.goalmaker1.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[1].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[2].firstchild) { _root.main.ma4.minutegoal2.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[2].firstchild; }else { _root.main.ma4.minutegoal2.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[2].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[3].firstchild) { _root.main.ma4.goalmaker2.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[3].firstchild; }else { _root.main.ma4.goalmaker2.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[3].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[4].firstchild) { _root.main.ma4.minutegoal3.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[4].firstchild; }else { _root.main.ma4.minutegoal3.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[4].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[5].firstchild) { _root.main.ma4.goalmaker3.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[5].firstchild; }else { _root.main.ma4.goalmaker3.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[5].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[6].firstchild) { _root.main.ma4.minutegoal4.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[6].firstchild; }else { _root.main.ma4.minutegoal4.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[6].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[7].firstchild) { _root.main.ma4.goalmaker4.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[7].firstchild; }else { _root.main.ma4.goalmaker4.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[7].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[8].firstchild) { _root.main.ma4.minutegoal5.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[8].firstchild; }else{ _root.main.ma4.minutegoal5.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[8].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[9].firstchild) { _root.main.ma4.goalmaker5.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[9].firstchild; }else{ _root.main.ma4.goalmaker5.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[9].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[10].firstchild) { _root.main.ma4.minutegoal6.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[10].firstchild; }else{ _root.main.ma4.minutegoal6.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[10].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].firstchild.childnodes[11].firstchild) { _root.main.ma4.goalmaker6.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[11].firstchild; }else{ _root.main.ma4.goalmaker6.text = my_xml.firstchild.childnodes[6].firstchild.childnodes[11].firstchild._visible ="" } //end golmaistori team 1 //golmaistori team 2 if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[0].firstchild) { _root.main.ma4.minutegoal21.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[0].firstchild; }else{ _root.main.ma4.minutegoal21.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[0].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[1].firstchild) { _root.main.ma4.goalmaker21.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[1].firstchild; }else{ _root.main.ma4.goalmaker21.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[1].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[2].firstchild) { _root.main.ma4.minutegoal22.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[2].firstchild; }else{ _root.main.ma4.minutegoal22.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[2].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[3].firstchild) { _root.main.ma4.goalmaker22.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[3].firstchild; }else{ _root.main.ma4.goalmaker22.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[3].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[4].firstchild) { _root.main.ma4.minutegoal23.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[4].firstchild; }else { _root.main.ma4.minutegoal23.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[4].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[5].firstchild) { _root.main.ma4.goalmaker23.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[5].firstchild; }else { _root.main.ma4.goalmaker23.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[5].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[6].firstchild) { _root.main.ma4.minutegoal24.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[6].firstchild; }else{ _root.main.ma4.minutegoal24.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[6].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[7].firstchild) { _root.main.ma4.goalmaker24.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[7].firstchild; }else{ _root.main.ma4.goalmaker24.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[7].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[8].firstchild) { _root.main.ma4.minutegoal25.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[8].firstchild; }else{ _root.main.ma4.minutegoal25.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[8].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[9].firstchild) { _root.main.ma4.goalmaker25.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[9].firstchild; }else{ _root.main.ma4.goalmaker25.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[9].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[10].firstchild) { _root.main.ma4.minutegoal26.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[10].firstchild; }else{ _root.main.ma4.minutegoal26.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[10].firstchild._visible ="" } if (my_xml.firstchild.childnodes[6].childnodes[1].childnodes[11].firstchild) { _root.main.ma4.goalmaker26.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[11].firstchild; }else{ _root.main.ma4.goalmaker26.text = my_xml.firstchild.childnodes[6].childnodes[1].childnodes[11].firstchild._visible ="" } //end golmaistori team 2 if (my_xml.childnodes[1]) { _root.main.navigator._visible = true; } else { _root.main.navigator._visible = false; } basically i'm checking existing nodes in field in 6 existing text fields. crazy!!! ideas how can made easier. , need load 2 <game> nodes every day.
Comments
Post a Comment