1 Reply Latest reply on Feb 17, 2008 4:27 AM by Newsgroup_User

    How to send text AND images to stage from xml?


      I have been a 'squirrel finder' tutorial from kirupa.com ( http://www.kirupa.com/web/xml/exampl...rrelfinder.htm) to try and create a fairly simple xml-fed flash interface. Basically, i need to have a list of architectural projects in a menu, and when each one is clicked the project info is loaded into a dynamic text field and a series of maybe 2 or 3 images are also sent to movie clips on the stage.

      I've got as far as just displaying the text using the tutorial: http://beentheunseen.ae-hosting.com/projects.html

      This is my xml file:

      <?xml version="1.0" ?>
      <item type="school">
      <name>Chapin School</name>
      <![CDATA[This school has been under development for many years...]]>
      <item type="school">
      <name>Molloy School</name>
      <![CDATA[Our work with Molloy has been...]]>
      <item type="school">
      <name>Deerfield Academy</name>
      <![CDATA[Text text text...]]>
      <item type="school">
      <name>Canterbury School</name>
      <![CDATA[Text text text...]]>

      And this is the AS code:

      function DisplayInfo(){

      infobox_mc._visible = true;
      infobox_mc.content_txt.text = this.location_text;

      var item_spacing = 18;
      var item_count = 0;

      function CreateMenu(menu_xml){

      var items = menu_xml.firstChild.firstChild.childNodes;
      for (var i=0; i<items.length; i++) {

      if (items .attributes.type == "school") {

      var species = items
      var location = items .childNodes[1];

      var item_mc = menu_mc.attachMovie("menu_item","item"+item_count, item_count);
      item_mc._y = item_count * item_spacing;

      item_mc.species_txt.text = species.firstChild.nodeValue;
      item_mc.main_btn.location_text = location.firstChild.nodeValue;

      item_mc.main_btn.onRelease = DisplayInfo;

      var squirrel_xml = new XML();
      squirrel_xml.ignoreWhite = true;

      squirrel_xml.onLoad = function(success){
      if (success) CreateMenu(this);
      else trace("Error loading XML file");


      Unfortunately the code is still mildly squirrel themed, lol. Could anyone help me to incorporate a way to display the images specified in the XML file at the same time as the project information? I assume i need to make a couple of movie clips on the stage and send the file url information to them somehow. I've tried adding bits of script from a number of tutorials and forums, but i don't seem to be able to make it work...