PDA

View Full Version : DataGrid Fonts in a masked environment


chillidog
07-08-2007, 08:16 AM
Hi,

I'm fairly new to components. I use MX Professional 2004.

I have placed a DataGrid component inside a masked MC. And DEEER, I don't see any text/fonts.

Can anyone tell me the formatting snytax to Embed font outlines for my DataGrid?


Mucho Gracias

microwebber
07-08-2007, 12:34 PM
Use the following ActionScript to embed fonts. The reference to my font refers to a Font symbol in the library, with linkage set to my font. The example assumes that you have a Font symbol in the library called my font, with linkage properties set as follows: the identifier set to my font and Export for ActionScript and Export in First Frame selected.

var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "my font";

this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160, 120);
my_txt.wordWrap = true;
my_txt.embedFonts = true;
my_txt.text = "Hello world";
my_txt.setTextFormat(my_fmt);


I took that from the help menu.
When you use a this in a component you will allow the user to select the font from a font linkage they have embedded. Use a variable for them to pass an argument to your component upon initiating it.

myInstance = new ComponentClass("their linkage");

assign that linkage in your class.

dezyn
07-09-2007, 12:32 AM
you would be better off creating your mask with code:


1.create mask and F8 create movieclip. Give it an instance name (yourMask)
2.place dataGrid/mc/mcholder on stage. Give it an instance name (yourMC)

yourMC.setMask("yourMask");


this will keep any styles you create intact.

best of luck.

chillidog
07-09-2007, 08:46 AM
yourMC.setMask("yourMask");


Thanks a lot, works a treat.