5 Replies Latest reply on Jan 23, 2007 5:52 AM by DazFaz

    Functions with parameters

    aquastealth Level 1
      Im working with a tutorial from LearnFlash.com that is called
      "Building a Website in Flash". Right now Im at "Lesson 10 - Button Rollover Effects"
      and I've tried to simplify the code by writing functions with parameters but I cant get it to work.
      Original code is as follows, (I know it doesnt look simplified but if you use it for multiple
      buttons it should help a lot):

      homeAnim_mc._visible = false;

      home_btn.onRollOver = function() {
      homeAnim_mc._visible = true;
      home_btn.onRollOut = function () {
      homeAnim_mc._visible = false;

      My code is this:

      homeAnim_mc._visible = false;

      function btn (btnName,anim) {
      eval(btnName).onRollOver = function() {
      eval(anim)._visible = true;
      eval(btnName).onRollOut = function () {
      eval(anim)._visible = false;

      home_btn = function() {

      Im a newbie and know I have done some basic mistake
      but I dont know what, please help me out.

      Thx for listening/Patrik