• home
  • forum
  • my
  • kt
  • download
  • Pars variables between movie clips

    Author: 2007-06-06 15:25:58 From:

    In 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 will start by creating all the items which will be part of this example.

    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.

    Photoshop Tutorial thumb picture


    2.
    Now before we make a text box I will quickly explain the three different text modes, and we will be using them all.
    First static, this is just plain text, in our case we will make a static text containing "enter name".

    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.

    Photoshop Tutorial thumb picture


    Now make a static text containing "enter name" make a input text field as shown in the image below.

    Photoshop Tutorial thumb picture


    3.
    Now draw some graphic as i did below, it doesn't matter how it looks, select it, right click and convert it to a movie clip.
    Now double click to get into the movie clip and make a dynamic text box inside the movie clip.

    Now your project should look something like this.

    Photoshop Tutorial thumb picture


    5.
    Now an important thing before we get to the coding is to name all our graphics so we can ref ere to them in code.

    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.
    Now we are ready to code.

    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) {
    _root.clip_1.get_text.text = _root.input1.text
    }
    --------------------

    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.

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (112)
      Backend (25)
      Text Effects (65)
      Drawing (18)
      Tips and Techniques (41)
      Dynamic Content (25)
      Tricks (6)
      Games (66)
      Utilities (19)
      Getting Started (71)
      Video (10)
      Interactivity (21)
      Web Design (22)

    New

    Hot