2 Replies Latest reply on Jun 14, 2006 2:03 AM by timdiacon

    argument in function not working properly?

    timdiacon
      I have a function which is something like this...

      my_button_rollout = function(item_id){
      if(item_id == _root.selected_project){
      _root["sub_menu.item_"+item_id].label_a.textColor = 0xFA7D00;
      } else {
      _root["sub_menu.item_"+item_id].label_a.textColor = 0x888888;
      }
      }

      When I call the function I am simply passing a number as the argument item_id, if I replace this line...

      _root["sub_menu.item_"+item_number].label_a.textColor = 0xFA7D00;

      with...

      _root.sub_menu.item_1.label_a.textColor = 0xFA7D00;

      It works as expected which leads me to belive either my syntax is wrong for incorporating the item_id argument or the number isn't passing through properly I have tried using both my_button_rollout (1) and my_button_rollout ("1")?

      Any help much appreciated as I thought I had got the hang of this syntax business!

      Tim