Groups | Blog | Home
all groups > flash actionscript > november 2005 >

flash actionscript : Can you mask an input field?



sampurtill
11/9/2005 11:35:11 PM
Hey,

I created a class file for movies that creates a dynamic mask for each movieclip. Can you mask a textbox too? I don't think you can, but if anyone knows that'd be great.

NSurveyor
11/9/2005 11:50:38 PM
You can. First, the textfield has to be in a movieclip so you can apply the
dynamic mask (using setMask). And then, you need to embed the font outlines for
the font. Open the library. Click on the top right corner (for the menu) and
select Add - or is it New?- font... Select the font you want to use and hit OK.
Right click on the font, and select Linkage... export it for actionscript with
linkage id, myFont. Then, in your code, you can use a TextFormat object to set
the font to myFont... for example:

my_fmt = new TextFormat();
my_txt.embedFonts = true;
my_fmt.font = "myFont";
my_txt.setTextFormat(my_fmt);

However, I believe if you use a device font like _sans you don't need to embed
font outlines.
NSurveyor
11/10/2005 12:00:00 AM
I'm pretty sure it needs to be in a MovieClip, because setMask is a MovieClip
method. So, whenever you create a textfield, just create a movieclip first and
then create the textfield within that movieclip.

And you're welcome.
sampurtill
11/10/2005 12:50:10 AM
Ok so the textfield needs to be inside the movieclip basically? I was wondering if you could mask a textfield that's just on the stage. Thanks though, that helps.

AddThis Social Bookmark Button