1 person found this helpful
I think you can just change the name property by assigning a new name.
I don't quite understand why you would ever want to change the name of something. Seems like coding is generally confusing enough without the names of things changing all the time.
I need the onChange function applied to specific text boxes depending on the selected button.
There is one input textbox, 10 dynamic text boxes and 10 buttons.
When button1 is clicked and the text is being typed in the input text box, it will apply the text to a text box.
then when button2 is clicked and the text is being typed in the same input text box, it will apply the text in to another text box.
have you got a better way in achieving this?
Well since I don't know everything you are doing it is hard to say, but this is how I would approach the problem....
curTarget.text = this.text;
// or what ever you need to happend on change function, but this is the simplest form
So assuming you have 10 textfields named targetField0, targetField1, etc. on the timeline. And an input textfield named inputText. And a movieclip button named selectorButton. The text you type in the input field will show up in targetField0 to begin with and then each time the button is clicked the next target textfield will get the results.
Is that sort of what you are trying to do?
Yes that is close to what I'm trying to achieve. Anyway below is my exact requirement:
There are 10 buttons instead of 1 button as in your description (selectorButton). When each button is clicked and then when the text is being typed in the INPUT TEXT box it should always update a given text field. See my example below.
BUTTONS instance names: selectorButton0, selectorButton1, selectorButton2, etc...
Dynamic Text Field Instance names: targetField0, targetField1, etc...
When selectorButton1 is clicked and then when the text is entered in the Input Text box it should always update targetField1. When selectorButton4 is clicked and then when the text is entered in to the Input Text box then it should always update targetField4. etc...
One more thing. If the input text field is in _root.movieA1.movieA2, and then selectorButton1,selectorButton2,etc.. are inside _root.movieA1 and the targetField1, targetField2, etc... are inside _root.movieX1 how will that effect your code?
I really appreciate your help.
Well I'm going to have to leave some of it as "an exercise for the reader" as it were. But the general idea would be something like this:
Or something like that. It is really hard to be sure about all the scopes since you have such "interesting" naming conventions. But you can use trace statements in your various handlers and places to see if you are getting the scope you think you should be getting and tweak it to refine that part. You will also need some of the stuff from before.
The best way to figure this stuff out is to play around with it.
Also you will notice I use a trick of making a "Home" variable that is the timeline I'm on and then using that instead of _root. That allows me to move the place of things or load this into another swf without having problems with _root.