11 Replies Latest reply on Feb 2, 2007 10:59 AM by Peter Lorent

    Tween using dynamic variable

    QuantumDynamix Level 1
      So I'm a huge supporter of trying to make my code reusable. I'm trying to build a tween with actionscript that I can use on a number of different object, depending on what variable I load into the function. However, I'm having a hard time writing the code.

      So, I have a button, that calls a function:

      on(rollOver){
      _root.fadeLogo(1, "out")
      }
      on(rollOut, dragOut){
      _root.fadeLogo(1, "in")
      }

      Then I have a function in the root of the movie:

      function fadeLogo(logoNumber, fadeEffect){
      if (fadeEffect=="out"){
      fadeClientLogo = new Tween("clientGridMC.logoHolder"+logoNumber, "_alpha", Normal.easeOut, "clientGridMC.logoHolder"+logoNumber+"._alpha", 0, .1, true)
      }else{
      fadeClientLogo = new Tween(("clientGridMC.logoHolder"+logoNumber, "_alpha", Normal.easeOut, "clientGridMC.logoHolder"+logoNumber+"._alpha", 100, .1, true)
      }
      }
      }

      However, this doesn't seem to do anything. I need this for a project going out on Tuesday. Any help would be GREAT! I would hate to have to simply duplicate this code 16 times simply to change a few numbers.