7 Replies Latest reply on Apr 22, 2006 2:41 PM by Robert_(IT-FX)

    When to use ; to terminate a function

    Robert_(IT-FX)
      I am working on building an xml slide show in flash and was looking at some code. Although I understand basic actionscript and the logic behind whats going on I am a little confused as to the syntax of using the terminating ; in a function. See example below.

      Example One


      function updateSlide(newSlideNode) {
      imagePath = newSlideNode.attributes.jpegURL;
      slideText = newSlideNode.firstChild.nodeValue;
      loadMovie(imagePath, targetClip);
      }


      Example Two


      // Event handler for 'Next slide' button
      next_btn.onRelease = function() {
      nextSlideNode = currentSlideNode.nextSibling;
      if (nextSlideNode == null) {
      break;
      } else {
      currentIndex++;
      updateSlide(nextSlideNode);
      currentSlideNode = nextSlideNode;
      }
      };



      Why does example one not have the ; ending the function whilst example two does have the ; ending the function.