|
|
Pars variables between movie clipsIn this Macromedia Flash tutorial I will show you how variables work, how to communicate or pars variable from one movie clip to another, which is a very important need to know base in actionscripting. 1. First of all we need to make a button, this is the button that will active the code we will be making later. Draw some graphic as I did below, select it, right click and convert to a button. 2. Then we have dynamic text, this is a text component that we can talk to, we can pars text into it by code. At last we have input text, here we can type in text, for filling out forms etc. This feature can be set in the text components properties as shown below. Now make a static text containing "enter name" make a input text field as shown in the image below. 3. Now your project should look something like this. 5. So select each object and in the properties field, name them, I named mine as shown below. The input field = input1 The graphical movie clip = clip_1 and the dynamic text box inside the movie clip = get_text 6. Its actually really easy and takes only a couple of lines of code. click your button, and go to the actionscript panel and type in the following code. -------------------- on (release) { } is containing the code, it says that when the mouse button is released on the button then the code in between will start. _root.clip_1.get_text.text = _root.input1.text _root is referring to the root of the scene, then .clip_1 is your movie clip .get_text.text is the text property of the dynamical text object. _root.input1.text is referring to the input text field in the root scene of the movie clip. You should now be able to type in the in the input text field and click the button os it will pars the text into the movie clip. |






