7 Replies Latest reply on Sep 13, 2007 9:09 AM by kglad

    Call a function, in an if statement

    multichild
      I have created a function to help load jpeg's into a movie holder depending on the name of the variable attached to the codebase.

      In this case the name of the variable in the codebase is "Home", but thats not really the problem, its the calling of the function of if a variable equals to the codebase variable, see below:

      var link = _root.button; is my trace on the webpage


      if (_root.button == "Home"){
      _root.onEnterFrame = function() {
      var link = _root.button;
      infoField._visible=true;
      startLoading("HomeImage.jpg");
      }
      };


      function startLoading(whichImage) {
      loadMovie(whichImage,"imageLoader");
      _root.onEnterFrame = function() {
      var link = _root.button;
      infoLoaded = imageLoader.getBytesLoaded();
      infoTotal = imageLoader.getBytesTotal();
      percentage = Math.floor (infoLoaded/infoTotal*100);
      infoField.text = percentage+"%";
      if (percentage>=100) {
      delete this.onEnterFrame;
      infoField._visible=false;
      }
      };
      }


      So my dilema is when (_root.button == "Home"), I want to call the function, but it doesnt seem to be working.