2 Replies Latest reply on Mar 12, 2007 4:25 PM by numerical07

    Create a button with value

    numerical07 Level 1
      Im just messing around with flash doing basic stuff. I want to create a small program that sends a value from a input text box, into a dynamic text box. One of my big problems is I dont know how to set the value of my button. How do I set values of my button. And say If I did set the value, how would I make the script run on click. So say if I named the button Clicker , the output box "OutputBox" and I named the input box "InputBox". would it be like this
      Function Clicker(InputBox);
      OutputBox:InputBox;


      Or something like that, I dont know, I suck, so help me out. And what exactly is the instance name.
        • 1. Re: Create a button with value
          Captain_Cainer
          To set the contents of a dynamic text box to be the same as an input text box, the code would be:

          myDynamicTextBox.text = myInputTextBox.text;

          An instance name is a name that you give an object on the stage so you can reference it in ActionScript. In the example above, the two instance names I was using were "MyDynamicTextBox", and "myInputTextBox".

          I usually use movie clips as buttons instead of actual buttons, but my guess is that in your case you can simply add the AS code above to your button so it executes whenever the button is clicked. If you used a movie clip called "myButton" as your button, you'd code it:

          myButton.onRelease = function() {
          myDynamicTextBox.text = myInputTextBox.text;
          }

          Hope that helps.
          • 2. Create a button with value
            numerical07 Level 1
            But what If I dont want to use a movie clip as my button after release to call on the AS to take what ever is in the input box, into the output box. What if I just want to take a button drag it onto the stage, and a input box and textbox and then code it. Would I do it the same ?

            I put what is in bold into the layer 1 actionscript (I only have 1 layer im using). I did not make the button a movie clip. Its a regular button I dragged from components. It compiled no errors but the program didnt work. When it comes down to writing script, do i have to put my script in certain places such as my button or on the layer. Or if I want to, could I write an entire program on a layer and thats it

            send.onRelease = Function();
            {
            outputbox.text = inputbox.text;
            }