3 Replies Latest reply on Mar 16, 2010 10:01 AM by DazFaz

    Variables with another Layer

    TheBrody

      I made a function to setup all the dynamic text on a layer and it looks like this:

       

      SkillP = SkillsMenu

       

      CmbP = "Combat Level: ";
      CmbT = SkillP.CombatLevel

       

      AtkP = "Attack Level: ";
      AtkT = SkillP.AttackLevel

       

      StrP = "Strength Level: ";
      StrT = SkillP.StrengthLevel

       

      DefP = "Defense Level: ";
      DefT = SkillP.DefenseLevel

       

      WcP = "Woodcutting Level: ";
      WcT = SkillP.WoodcuttingLevel

       

      FshP = "Fishing Level: ";
      FshT = SkillP.FishingLevel

       

      updateSkills();

       

      function updateSkills(){
          trace(Level);
          CmbT.text = CmbP + Level;
          AtkT.text = AtkP + AtkLvl;
          StrT.text = StrP + StrLvl;
          DefT.text = DefP + DefLvl;
          WcT.text = WcP + WcLvl;
          FshT.text = FshP + FishLvl;
      }

      Then on another layer I have this:

       

      // -- Levels -- \\
      Level = 1;
      AtkLvl = 1;
      StrLvl = 1;
      DefLvl = 1;
      WcLvl = 1;
      FishLvl = 1;

      // -- Levels -- \\

       

      But on my function when I do trace(Level) it just traces Undefined.

      But if I add trace(Level) to my other lay it traces 1;


      Why is this happening?