0 Replies Latest reply on Sep 15, 2010 4:02 PM by daymonic

    help needed to STOP xml loading

    daymonic Level 1

      Hi there,

       

      I'm pretty new to the action script side of things, have had some help on here already and have also been pulled up for asking for too much help.

      Well I'm kind of getting the hang of it now, but am having one major problem with the site I'm making, basically I've been following a tutorial for an xml based website, just about got my head round it but I need one line of code to stop the xml movie clip playing when I load a new one (eg when you navigate to a new page.

       

      this is the current code, if anyone can help I'd be massively thankful, this project has been doing my head in for weeks now - fingers crossed folks D

       

      // onLoad XML function

      function loadXML(success) {

      if (success) {

      // If the XML loads successfully, count how many projects there are in the file.

      _root.projectCount = this.firstChild.childNodes.length; // PROJECT node in XML file

      // Then run a function that builds arrays out of the XML data.

      SS_Arrays();

      } else {

      // If the xml data did not load, show message on stage by populating the description field.

      _root.description = "Error: Could not load XML";

      }

      }

       

      /////////////////////////////////////////////////////////////////////////////////////////

       

      function SS_Arrays() {

      for (var count = 0; count < _root.projectCount; count++) {

      var nodeObj = objXML.firstChild.childNodes[count];

      namesArray[count] = nodeObj.attributes.name;

      descriptionsArray[count] = nodeObj.attributes.description;

      linksArray[count] = nodeObj.attributes.link;

      filesArray[count] = nodeObj.attributes.file;

      }

      // run the function to create the thumbnail and list view buttons

      SS_createButtons();

      }

       

      /////////////////////////////////////////////////////////////////////////////////////////

       

      function SS_createButtons() {

      // First of all we want to hide the master button on the stage (btn_projects_main)

      // because we'll be making duplicates of it in the next part of the function

      _root.btn_projects_main._visible = 0;

       

      // Work out the X and Y positions of the main button so our new buttons start in the same place

      // (Which means where ever you position the main button is where the navigation will start).

      btn_xPos = _root.btn_projects_main._x;

      btn_yPos = _root.btn_projects_main._y;

       

      // Set the distances between your buttons and the number of rows

      btn_xDistance = 140;

      btn_yDistance = 19;

      btn_numOfRows = 5;

      // This figure is used to work out when to start a new column of buttons

      btn_yMax = btn_yPos + ((btn_numOfRows - 1) * btn_yDistance);

       

      // Loop through the projects array and create a button for each one by duplicating the original.

      for (count = 0; count < _root.projectCount; count++) {

      duplicateMovieClip(_root.btn_projects_main, "btn_projects" + count, count);

      // As the button is created, set it's X, Y & text properties

      _root["btn_projects" + count]._x = btn_xPos;

      _root["btn_projects" + count]._y = btn_yPos;

      _root["btn_projects" + count].text = namesArray[count];

       

      // set the X position for the next button

      if(btn_yPos == btn_yMax){

      // if the last buttons was the last row in the column (based on it's Y position) then start a new column

      // by resetting the Y position and adding 140px (btn_xDistance) to the the X position.

      btn_xPos = btn_xPos + btn_xDistance;

      btn_yPos = _root.btn_projects_main._y;

      } else {

      // if it's not the last one in a row, simply move it along the Y axis.

      btn_yPos = btn_yPos + btn_yDistance;

      }

      }

       

      // Load the first project (number 0) to avoid an empty screen

      SS_load_project(0);

       

      // Make the first project button highlighted

      tellTarget(_root.btn_projects0){

      gotoAndPlay(3);

      }

      // Set the current button variable so we know which button to switch off when another one is pressed

      _root.curButton = "0";

      }

       

      /////////////////////////////////////////////////////////////////////////////////////////

       

      function SS_load_project(arrayNumber){