| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
The Zen of ActionScript
Join Date: Mar 2001
Location: Dublin, Ireland
Posts: 713
|
Hi,
I am trying to read from an external XML file into a movie. This is fine for text fields on the main timeline but will not work for bringing it into text fields within movie instances. Any idea how I can do this? The code I am using at the moment is... LPXML = new XML(); LPXML.load("LPtest.xml"); function populateTextFields () { DisposableXML = new XML(); TempXML = new XML(); ClickList = new Array(); DisposableList = new Array(); ClickList = LPXML.firstChild.childNodes; i = 0; while (i<=ClickList.length) { if (ClickList[i].nodeName.toLowerCase() == "click") { DisposableXML = ClickList[i]; DisposableList = DisposableXML.childNodes; ii = 0; while (ii<=DisposableList.length) { TempXML = DisposableList[ii]; if (DisposableList[ii].nodeName.toLowerCase() == "lptitle") { lptitle = lptitle +"<font type=\"Arial\" size=\"13\" color=\"#000000\"><b>"+DisposableList[ii]+"</b></font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "text1") { text1 = text1+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "text2") { text2 = text2+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "text3") { text3 = text3+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "text4") { text4 = text4+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "text5") { text5 = text5+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "text6") { text6 = text6+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "text7") { text7 = text7+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "weblink1") { WebLink1 = TempXML.firstChild.nodeValue ; } else if (DisposableList[ii].nodeName.toLowerCase() == "qintro") { questionintro = questionintro+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "questionstem") { questionstem = questionstem+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "questionprompt") { questionprompt = questionprompt+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "partlyright") { partlyright = partlyright+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "incorrect") { incorrect = incorrect+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "correctfeedback") { correctfeedback = correctfeedback+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "cancel") { cancel = cancel+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } else if (DisposableList[ii].nodeName.toLowerCase() == "option1") { _root.option1.option1 = _root.option1.option1+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>"; } ii = Number(ii)+1; } } i = Number(i)+1; } } LPXML.onLoad = populateTextFields; _________ the option1.option1 at the bottom is the instace of ooption1 with a text field called option1 within it. All the rest work fine. Just not to the internal text field. Thanks! |
|
|
|
|
|
#2 |
|
The Zen of ActionScript
Join Date: Mar 2001
Location: Dublin, Ireland
Posts: 713
|
Yes, I am replying to myself!
Just in case anyone has the same problem. What I did to get it to work was bring in the text for option1 onto the main timeline like all the other variables, and then bring it into the movie from within the movie with option1 = _root.option1; Can't believe I didn't try that sooner. If anyone has a better way of doing it I'd love to hear. regards |
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| removeMovieClip() not work for components? | djandrew | Components | 30 | 08-03-2007 05:51 PM |
| Movie clips that won't act like buttons! | guytrenzich | ActionScript 2.0 | 6 | 06-24-2007 10:39 PM |
| unloading multiple movie clips | asprinwizard | ActionScript 2.0 | 2 | 06-08-2006 03:21 PM |
| Skinning components with embedded components | epeace | Components | 5 | 06-16-2005 09:35 PM |
| Movie Clips Order | Luigi Vercotti | ActionScript 1.0 (and below) | 2 | 02-27-2004 11:32 AM |