Embedding movie clip symbols

To embed a movie clip symbol in a text field, you specify the symbol's linkage identifier for the <img> tag's src attribute. (For information on defining a linkage identifier, see Attaching a movie clip symbol to the Stage.)

For example, the following code inserts a movie clip symbol with the linkage identifier symbol_ID into a dynamic text field with the instance name textField_txt.

To embed a movie clip into a text field:

  1. Create a new Flash document and save it as embeddedmc.fla.
  2. Draw a new shape on the Stage, or select File > Import > Import to Stage and select an image that is roughly 100 pixels wide by 100 pixels high.
  3. Convert the shape or image imported in the previous step by selecting it on the Stage and pressing F8 to open the Convert to Symbol dialog box.
  4. Set the behavior to Movie Clip and enter a descriptive symbol name. Select the upper-left square of the registration point grid, and click Advanced to switch to advanced mode if you haven't already done so.
  5. Select the Export of ActionScript and Export in First Frame check boxes.
  6. Enter the linkage identifier img_id in the Identifier text box and then click OK.
  7. Add the following ActionScript to Frame 1 of the main Timeline:
    this.createTextField("textField_txt", 10, 0, 0, 300, 200);
    textField_txt.html = true;
    textField_txt.htmlText = "<p>Here's a movie clip symbol:<img src='img_id'>";
    

    For an embedded movie clip to be displayed properly and completely, the registration point for its symbol should be at point (0,0).

  8. Save your changes to the Flash document.
  9. Select Control > Test Movie to test the Flash document.