Nesting MovieClips
Hello once again folks. The fun never ends eh?
I am trying to nest some XML fed dynamic text fields converted into MovieClips and exported to actionscript via linkage to appear in another movieclip that I want to use as a holder or mask so that I may scroll through several of these movieclips. Each MoveClip has two dynamic text fields in it, one that displays the price and another that displays the description. For example, MovieClip "itemClip_2_mc" contains both "price2_txt" and "description2_txt" text fields. "itemClip_2_mc" has beenexported to Actionscript via linkage as "itemClip_2_mc".
If I put all five movieClips onto the stage and give them all instance names and add the instance name to the front of the loaded function, all five load just great.
But when I create an empty movieclip, put it on the stage and give it an instance name of empty_mc, it will not load the itemClip_2_mc from the library, or if it is loading it is not displaying the XML text. What am I doing wrong?
Is there a component that would work better for this?
Here is my XML file (paradise.xml);
<?xml version="1.0" encoding="UTF-8"?> <copy> <item> <price>$599.00</price> <description>Jamacian Holiday. Come stay at out 5 star resory by the sea. All inclusive!</description> </item> <item> <price>$1,299.00</price> <description>Bermuda Holiday. Come stay at out 4 star resory by the sea. All inclusive!</description> </item> <item> <price>$2,200.00</price> <description>Bahamas Holiday. Come stay at out 2 star resory by the sea. All inclusive!</description> </item> <item> <price>$3,300.00</price> <description>Greek Holiday. Come stay at out 1 star resory by the sea. All inclusive!</description> </item> <item> <price>$5,500.00</price> <description>Spanish Holiday. Come stay at out 0 star resory by the sea. Nothing included!</description> </item> </copy>
Here is my actionscript;
function loadXML(loaded) { if (loaded) { var price = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; var desc = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue; price_txt.text = price; description_txt.text = desc; var price2 = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue; var desc2 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue; price2_txt.text = price2; description2_txt.text = desc2; var price3 = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue; var desc3 = this.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue; price3_txt.text = price3; description3_txt.text = desc3; var price4 = this.firstChild.childNodes[3].childNodes[0].firstChild.nodeValue; var desc4 = this.firstChild.childNodes[3].childNodes[1].firstChild.nodeValue; price4_txt.text = price4; description4_txt.text = desc4; var price5 = this.firstChild.childNodes[4].childNodes[0].firstChild.nodeValue; var desc5 = this.firstChild.childNodes[4].childNodes[1].firstChild.nodeValue; price5_txt.text = price5; description5_txt.text = desc5; } else { content = "file not loaded!"; } } empty_mc.attachMovie("itemClip_2_mc", "newName", 1); xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("paradise.xml");
help! 🙂
Forrest
