views:

457

answers:

1

Hello,

I have two questions:

I am trying to embed fonts via this page in the livedocs.

  • Can anyone tell me what I need to do to use an external style sheet? Should it be a style sheet or an mxml file? I saw this tutorial, which offers quite a bit of good information (some of which I also found in the livedocs) via the comments.

EDIT: here is what I am trying...

I have a class that I instantiate:

private var myTextDraw:TextSpriteDraw = new TextSpriteDraw();

How can I let this class use the font I have just embedded? See below for details on what I am trying...

Here is how I am attempting to call up the mxml file:

<mx:Style source="..assets/fontSpecifications.mxml" />

Here is my xml:

<?xml version="1.0"?>
<!-- specification for how to embed fonts -->

<mx:Application xmlns: mx="http://www.adobe.com/2006/mxml"&gt;
    <mx:Style>

        @font-face: {
            src: url("location") | local("name");
            fontFamily: 'myTimesFont', "_serif";
            color: black;
            fontStyle: normal;
            fontWeight: normal;
            advancedAntiAliasing: false;
        }

    </mx:Style>

    <mx:Script>
        [ Embed(source='../assets/Times.dfont', fontName='myTimesFont', mimeType='application/x-font') ] 
    </mx:Script>
<mx:Application>

Now what I don't understand is how to use the font that I have embedded (or if I am even doing this properly... note that all i want to do is get a TextField() w/ 'Times' to behave properly when I change its alpha):

+1  A: 

The external style sheet can be used by doing <mx:Style source="my/css/Style.css" />

On the second question I'm not sure what you're asking. Are you wondering if you should use the Flex Framework or a pure AS3 project? Or the tools in the Flash IDE versus Flex Builder for dealing with fonts?

=Ryan [email protected]

ryanstewart
ok; i don't need anything in the contents of the mx:Style tag then? can i include everything in the style sheet and then use an embed tag?... regarding your question- i am wondering about the latter- should i use the tools involved in the flash ide vs. the tools in flex builder for dealing with fonts?
jml
@ryan: I have updated my question to show you what I am trying to do; I have included all of the relevant source and more specific questions for how to do this in Flex.
jml
okay, I got it. So you won't use an MXML page as the source of the stylesheet, you'll just use a CSS file which would contain the stuff you have in your < mx:Style > tag in the second bit of code.Then in your main application you can use the < mx:Script > tag with the embed metadata to embed that font.Does that make sense?
ryanstewart
I think so. I will give it a try, do some research based on what you are suggesting, and post back if necessary. I'm sure that this is enough information, but it's a bit of a new topic for me so I am assuming this will be what I need to get over the curve.
jml
Feel free to drop me an email or ping me on IM if that helps. gtalk:[email protected] and aol:rcstewart82
ryanstewart
great; thanks, ryan.
jml