# Masking textfields at runtime, not embeded(quick fix)

**URL:** <https://forum.kirupa.com/t/masking-textfields-at-runtime-not-embeded-quick-fix/238392>\
**Category:** flash\
**Created:** [September 10, 2007, 8:49pm UTC](https://forum.kirupa.com/t/masking-textfields-at-runtime-not-embeded-quick-fix/238392 "2007-09-10T20:49:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![project1\_exe](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@project1\_exe](https://forum.kirupa.com/u/project1_exe)\
**Post date:** [September 10, 2007, 8:49pm UTC](https://forum.kirupa.com/t/masking-textfields-at-runtime-not-embeded-quick-fix/238392/1 "2007-09-10T20:49:26Z")

</div>

I have a movieclip(instance name:mymc) with some textfields(tf1, tf2, tf3) in it, and that movieclip has a class definition.

The movieclip contains another movieclip(just a simple movieclip with a square shape inside, instance name:masking) with a instance name, and I resize it at runtime. When I set that movieclip as a mask for the for mymc in the class definition, it works, masks all the textfield and shapes.

mask = masking;

however, when i remove that line above and try to mask each object in the movieclip, it only works for movieclips/sprites inside it.

circle.mask = masking;  
mc2.mask = masking;  
tf1.mask = masking; \<---- works  
tf2.mask = masking; \<---- this line will remove masking on tf1, and then be applied on tf2.  
tf3.mask = masking; \<---- this will remove on tf2, and then works on tf3.

i know some newbies with as3 like me will be questioning “howcome it doesn’t behave like how the algo is defined?”. my quick fix, put the textfields inside another sprite/mc then apply the mask there.

var s:Sprite = new Sprite();  
s.addChild(tf1);  
s.addChild(tf2);  
s.addChild(tf3);  
addChild(s);  
s.mask = masking \<---- this will now work, masking all of the textfields 🙂

i dunno why this is the behavior with textfields. i hope this quick fix will help you guys 🙂 cheers!

any better ways is always welcome 🙂
