7 Replies Latest reply on Apr 28, 2006 7:40 AM by kglad

    Variables

    JRatzo
      What I want to do is have about 10 frames with 2 buttons on them. Both buttons when clicked on will go to the next frame (which i know how to do i think). Next I want to have a variable that when one button on the screen is clicked goes to the next frame and increases the variable by one. The other button i want to have decrease the variable and go to the next frame. Then on the last frame i want to have the variable displayed. Can someone please help me with the scripts please.

      Thank you in advanced

      --Justin
        • 1. Re: Variables
          Level 7
          JRatzo wrote:
          > What I want to do is have about 10 frames with 2 buttons on them. Both buttons
          > when clicked on will go to the next frame (which i know how to do i think).
          > Next I want to have a variable that when one button on the screen is clicked
          > goes to the next frame and increases the variable by one. The other button i
          > want to have decrease the variable and go to the next frame. Then on the last
          > frame i want to have the variable displayed. Can someone please help me with
          > the scripts please.

          put this code on frame 1:
          var myvar:Number = 0;
          this.increase_btn.onRelease = function()
          {
          this._parent.myvar++;
          this._parent.nextFrame();
          }
          this.decrease_btn.onRelease = function()
          {
          this._parent.myvar--;
          this._parent.nextFrame();
          }
          also on frame 1, put your two buttons, with instance names of
          'increase_btn' and 'decrease_btn', respectively.

          on last frame, stick a dynamic textfield on the timeline and put 'myvar'
          into the 'variable' field in the textfield's properties inspector

          --
          MOLOKO
          Macromedia Certified Flash MX 2004 Developer
          Macromedia Certified Flash MX Developer
          ------------------------------------------------
          ::remove _underwear_ to reply::
          'There ain't no devil - it's just God when he's drunk' Tom Waits
          ------------------------------------------------
          GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+ w+++$ !O M+
          VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e h-- r+ y++
          • 2. Re: Variables
            kglad Adobe Community Professional & MVP
            attached to the first frame and then each frame:

            • 3. Re: Variables
              JRatzo Level 1
              Thank you very much. I got the text field working but i cannot move it or change the size... it is just in the upper left hand corner of the screen... can you help me

              thank you

              --Justin
              • 4. Re: Variables
                JRatzo Level 1
                I actually can move the text field so thank you for that. How would i change the size and color of the text?

                thank you

                --Justin
                • 5. Re: Variables
                  kglad Adobe Community Professional & MVP
                  you can either create a textfield in the authoring environment with the text properties you want and eliminate the createTextField code, or you must define a textformat object (or styleshee) and apply that to the textfield.
                  • 6. Re: Variables
                    JRatzo Level 1
                    I got it all working thanks alot


                    --Justin
                    • 7. Re: Variables
                      kglad Adobe Community Professional & MVP
                      you're welcome.