3 Replies Latest reply on May 1, 2007 9:40 AM by ggshow

    help with onRollOver and eval

    NickTheNameless
      i have two movie clips on the stage, one with an instance name of TTbutton1 and one with an instance name of TTMO112003link4. i can not get the onRollOver function of the TTMO movie clip to work after fetching variables from my php file. what am i doing wrong?

      here's my code with notes to explain along the way....

      this.loadVariables("linkCCdisplay.php","POST"); //fetches 3 variables, title1, url1, and id1 (title1 is used elsewhere)

      TTbutton1.onRelease = function() {
      TTbutton1.getURL(url1, _blank);
      }; //this makes the movie clip "TTbutton1" go to url1 onRelease

      this.TTMO112003link4._visible = false; //i would like to toggle the visibility of this movie clip later down in this script

      myInterval = setInterval (TTMO,15);

      function TTMO () {
      TTMO112003link4._x -= (TTMO112003link4._x - _xmouse)/10;
      TTMO112003link4._y -= (TTMO112003link4._y - _ymouse)/10-2;
      } //this works fine

      TTbutton1.onRollOver = function() {
      this["TTMO"+id1]._visible = true;
      } //here's my problem line

      right now id1 = "112003link4", so i would like it to add the value after the text "TTMO", thus giving me "TTMO112003link4". i would then like the movie clip with the instance name "TTMO112003link4" to be visible when you pass the mouse over the movie clip with the instance name of "TTbutton1".

      please help, thanks for your time!
        • 1. help with onRollOver and eval
          dazzie
          I would replace the line *this["TTMO"+id1]._visible = true* with two lines as follows:-

          myclip = eval("_root.TTMO"+id1);
          myclip._visible = true;

          I think you may have been targetting inside the TTbutton1 clip with the original statement.
          You may find that you might need to use _root.id1 on the end of that first line as I think that variable resides at _root level too.
          • 2. Re: help with onRollOver and eval
            NickTheNameless Level 1
            thanks for your answer, but it's not working. i see what you're saying and tried it.... but still no go. i think it might be because i'm using loadVariables and not LoadVars. i saw some other posts about that, but i can't get LoadVars to work for me. someone else in these forums suggested using loadVariables with a loop, but his script did not work either. oh well, maybe i should try reposting about the use of LoadVars again. you wouldn't have any advice about LoadVars would you? thanks again for your time.
            • 3. Re: help with onRollOver and eval
              ggshow Level 2
              since your button TTbutton1 is a movieclip,

              TTbutton1.onRollOver = function() {
              this["TTMO"+id1]._visible = true;
              // when you say "this" here, it means TTbutton1
              }

              try change your script to:

              TTbutton1.onRollOver = function() {
              this._parent["TTMO"+id1]._visible = true;
              }

              if your TTMO112003link4 is located at _root, you can also try this:

              TTbutton1.onRollOver = function() {
              _root["TTMO"+id1]._visible = true;
              }