2 Replies Latest reply on Nov 13, 2006 7:12 AM by duckets

    Presenting Results

    wobo63
      Hello, I would like to have a figure increased whenever a klick on a defined button is detected. Anywhere on the screen I would like to have the current value (points collected) displayed and updated with each correct klick. Whatever I try with string and variables I do not succeed. Any help please for an example?

      Thank you
        • 1. Re: Presenting Results
          Chunick Level 3
          setup:
          1. place a button on the screen (if you are using MX2004 make sure it's Director's bult-in button and not a flash component by looking at the toolbox's title in the left. If it reads 'default' or 'flash component' then click on the down arrow beside the name and change it from the list that apepars to 'classic'.)
          2. place a text or field member on the screen and make sure to name the member "input" (without quotes).

          3. Create a behavior script (below) and attach it to the button.
          -- behavior script on a button
          on mouseUp me
          val = value(member("input").text)
          val = val + 1
          member("input").text = string(val)
          end
          • 2. Re: Presenting Results
            duckets Level 1

            Another method is to have a behaviour use a reference to a property on its "script cast member". These are a little like what are known as static variables.

            (Example code attached)

            - Ben