Dynamic Text Box in Nested Movie Clip Using Actionscript 3.0 With Mask!

I ran into an unusual problem yesterday while developing a complex flash movie. I discovered that Flash does not allow you to change dynamic text in a nested movie clip if it is masked. I don’t do a lot of work with Flash or Actionscript 3.0 but it seems odd to me that this is not possible.

Unfortunately, using this text box was the only way to achieve the result I was looking for so I had to find a work around. I searched around the net and found a couple of possible solutions but everything I found was geared towards Actionscript 2.0 and nothing I found worked in my Flash movie.

Finally, after searching around with no luck I decided to develop my own solution. How I solved this problem was I created an externally imported package that stored a set of global variables. (I did this because Actionscript 3.0 doesn’t have a built in global variable method) I then set the value of these global variables in my main movie. After they were set I went into my nested movie clip and added a quick bit of Actionscript to set the value of the text box within that movie clip from the global variable. When the movie runs the dynamic text box in the movie clip is updated with content from my main Actionscript file.

Note: One thing I will mention is that I did not try this with a movie clip that was added to the stage prior to setting the global variable. In my particular example I am setting the global variable in Actionscript and then adding the movie clip to the stage also using Actionscript. I don’t know if it will work if the value is updated after the movie clip has been added to the stage but it is worth a try.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

hey mate,
i wonder if you can help me with my flash movie.
Im doing a button, that when you click it (on press) it will go to frame 2 and play an animation, but in that animaiton i have a dynamic text conected to a php database. The thing is that the information is not appearing, but when i do the same thing, but instead of converting it into a movie clip i put it as a graphic it works.
I dont know how to make the dynamic text appear in a movie clip.
See you mate

I had a similar problem recently (all be it with as2), the dynamic text in the swf worked great until the movie was masked, however embedding the font for the dynamic text areas solved the problem…

I don’t often use flash/as but perhaps but it sounds like that could be the solution for you also?

Leave a comment

(required)

(required)