1 Reply Latest reply on Jun 8, 2008 7:42 AM by kglad

    Global variabels

    Viic
      Hi.

      I want to be able to keep a couple of variables ( number) and be able to edit theses variables from within the actioncode of a button or MovieClip.

      For example:

      I have 3 variables
      number of eggs

      number of apples

      number of toasts


      and when I press button addEgg number variable eggs adds plus one.

      The problem is, this is not a problem if you have all the actioncode at ONE place (in one frame). But when you have actioncode inside a button and MovieClip and in different Keyframes it doesn't work so easily.

      Is there any way to keep variables that is reachable from every button and MovieClip in the flashfile?
        • 1. Re: Global variabels
          kglad Adobe Community Professional & MVP
          you can make variables global by prefixing them with _global whenever you assign a value.

          p.s. you should start thinking about designing applications with code all in one location - usually the main timeline, frame 1.