0 Replies Latest reply on Aug 8, 2006 7:39 AM by Newsgroup_User

    onRelease - function: syntax problems

    Level 7
      hi,
      i have on my stage a MC called '_mc', to which i want to attach a simple
      'onRealse' function. this is the code on the first frame in the timeline:
      function test() {
      trace("test")
      }
      _mc.onRelase = test()

      once i test this i get 'test' in the output window and nothing happens when
      i click the MC.
      so, i try this -
      function test() {
      trace("test")
      }
      _mc.onRelase = test

      now it works nicely - clicking the MC results in 'test' in the output
      window.
      however, what do i do if i want to pass parameters to the 'test' function?
      trying this -
      function test(param) {
      trace(param)
      }
      _mc.onRelase = test("xx")

      will result in having 'xx' in the output window once its tested, but nothing
      when the MC is clicked.
      trying this -
      function test(param) {
      trace(param)
      }
      _mc.onRelase = test

      will result in having 'undefined' in the output window once the MC is
      clicked.

      so what's the right way to do it???
      the reason i'm working this way, and not having simply -
      _mc.onRelease = function() {
      trace("xx");
      }
      is that i want to attach the same function to several MC's, each of them
      sending a different parameter to the function.

      any suggestions??
      thanks,
      eRez