How to Control Masked Dynamic Text with ActionScript 3

Okay this took a lot of my time but happily with some googling & ingenuity I managed to find a solution.

The problem was that I had a dynamic text field that needed to be masked with an animated mask, the mask was a tweened shape.

Dynamic text fields tips

1st of all don’t leave your dynamic text field naked, put it inside a Movie Clip (select the field, hit F8 & choose Movie Clip).

2nd, if you have problems displaying the text field content, use the “Character Embedding…” feature in the Properties panel.

3rd, to access the dynamic text field from the “actions” layer in your main time line, while the text field is inside a symbol, inside a symbol, inside… well, you need to use dot syntax. For example: Your text field instance is myText_txt, it’s inside a Movie Clip instance called movieIn_mc & this one inside a Movie Clip instance called movie_mc, you type this in your Actions panel:

movie_mc.movieIn_mc.myText_txt.text = String("My Cool Text!");

Converting a mask to a Movie Clip

Now to the solution of our main problem, when changing the text of a non-masked dynamic text field using ActionScript, everything works fine, but when you try so on a masked text field it may or may not work.

To solve this, all you have to do is to convert the mask to a Movie Clip symbol (very important to be a Movie Clip!), but this maybe tricky, especially if the mask is a tween. To do it:

  1. Select all the frames of the mask (a Left Click on an end & a Shift + Left Click on the other end)
  2. Right Click the selected frames & choose “Copy Frames”
  3. Create a new Movie Clip symbol (Ctrl + F8 & choose “Movie Clip”)
  4. Right Click the empty frame inside the new Movie Clip & choose “Paste Frames”.

OK, now go empty the frames of the mask & insert your new symbol. It maybe wise to note the X & Y positions of the shape before removing it, so you can put the symbol in its exact X & Y positions.

That’s it, your code should work fine now, there’s another method you could find on the net that involves creating a mask dynamically using ActionScript, but it’s enough to use my method & I guess it’s shorter & easier :)