Embedding fonts in AS3 with absolute paths

I'm having difficulty embedding fonts in AS3. For instance,
using absolute paths:
[Embed(source="C:\WINDOWS\Fonts\CONSOLA.TTF",
fontName="Consolas", mimeType="application/x-font-truetype")]
... I get the error message: "Error: unable to resolve
'C:WINDOWSFontsCONSOLA.TTF' for transcoding.
I'm hoping the backslashes are missing from the error just
because the compiler doesn't return them, and not that it's losing
them. I've tried various TTFs with the same result. Even tried
copying code from the AS3 Cookbook letter for letter. :)
Thoughts?

I have a similar issue happening. I am using AS3 and have
this code in my file:
// package, import statements etc...
// the line below is the problematic line
[Embed(systemFont="..\\..\\..\\fonts\\arial.ttf",
fontName="Arial (True Type)",
mimeType="application/x-font-truetype")]
// now declare my class
public class ImageRotator extends UIComponent
// etc.
The class compiles fine but when I try to run it I get the
following runtime error:
"Error: Error #2136: The SWF file
file:///C:/projects/photogallery_screensaver/bin/photogallery_screensaver.swf
contains invalid data."
I've tried several things including changing the location of
the font file, using a different font file, embedding a systemFont.
But I always get the same error.
Help please!
Thanks,
Dan

Similar Messages

  • Embedding Fonts in AS3

    Maybe someone here can help me understand this a bit
    better.....
    These questions are based on the AS3 Cookbook recipe 9.17
    (Embedding Fonts)...
    According to the cookbook, embedding fonts in AS3 requires
    using the [Embed] metatag "inside an AS file outside the class
    declaration". I can't figure out (based on the cookbook), what I'm
    doing wrong... I've attached my entire class so go ahead and see
    what I'm doing wrong...or not understanding here...
    It's the entire class at this point.... still migrating my
    stuff from AS2 to AS3....

    SymTsb,
    Can you provide a working AS and Fla? If not, do you mind
    posting your code? I'm having similar problems and have been
    searching for a solution for days now. I tried copying the code
    above and applying KGlad's suggestion, but it still doesn't work.
    I went to the library panel and added a new Font. In the name
    field I added "_arialBold". Then I hit OK. I then right clicked and
    selected linkage. I checked off "Export for AS"and "Export in first
    frame". In the class field I put "_arialBold". The base class was
    "flash.text.Font". In the class you created, I replaced every
    instance of the word "Vivacious" with "_arialBold". I added KGlads
    code one line after you defined the TextFormat.
    In my fla, I imported your class and then created a new
    instance of your class. I ran the file... blank screen...
    Help
    V

  • This component requires that the embedded font be declared with embedAsCFF=false.

    I'm getting the following warning for my project.
    "warning: incompatible embedded font 'MyFont' specified for views::MyViewInnerClass0 (MyViewInnerClass0_61) . This component requires that the embedded font be declared with embedAsCFF=false."
    Here's what I have in my style.css file.
    /* CSS file */
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace supportClasses "spark.globalization.supportClasses.*";
    @namespace views "views.*";
    @font-face {
              src: url("assets/MyFont.ttf");
      fontFamily: "MyFont";
      advancedAntiAliasing: true;
      embedAsCFF: true;
    @font-face {
              src: url("assets/MyFont.ttf");
      fontFamily: "MyFont";
      advancedAntiAliasing: false;
      embedAsCFF: false;
    The 2nd font section I have is what is suggested as the fix in most places but that isn't working out for me. I wonder if I'm missing something else.

    I tried changing the name and it didn't work. Tried all sort of combinations too and none worked. Tried a different font and that didn't work too.
    Turns out the problem wasn't in the declaration of the fonts but where I was using it.
    I initially had the font declared globally
    global
       fontFamily: DroidSansMono;
    I saw that, in your comment you had mentioned "..then apply it to the component" so I applied the font to the label component
    s|Label
      fontFamily: DroidSansMono;
    and boom.. no warning. Problem solved.
    Thanks so much.

  • This component requires that the embedded font be declared with embedAsCFF=true.

    Hey all,
    I fall into a small problem with fonts embedding. In my application I have embedded over 50 fonts and all expect one works as expected.
    That one shows an error "warning: incompatible embedded font 'Algerian-CFF' specified for spark.components::RichEditableText (RichEditableText310) . This component requires that the embedded font be declared with embedAsCFF=true."
    I have been looking all over the internet for similar problem, without success. Why this font is not working while all the rest does? Any clues?
    /* CSS file */
    @namespace s "library://ns.adobe.com/flex/spark";
    /* embedded font */
    @font-face {
    src: url("ttf/ALGER.ttf");
    fontFamily: Algerian-CFF;
    Thanks.

    Thanks,
    My issue is not to embed a font twice. Let me describe the issue so this will helpful.
    I have embed a fonts like below code.And apply LucidaBlackletterSpark font for spark component but it gives me error like
    "warning: incompatible embedded font 'LucidaBlackletterSpark' specified for spark.components::RichEditableText (RichEditableText2301) . This component requires that the embedded font be declared with embedAsCFF=true".
    But Font have already embedAsCFF property true. I am not able to find the solution why it is give me this warning.Due to that i am not able to embed a font.
    @font-face {
              src: url("assets/fonts/LucidaBlackletter.ttf");
              fontFamily: LucidaBlackletterSpark;
              embedAsCFF: true;
    @font-face {
              src: url("assets/fonts/LucidaBlackletter.ttf");
              fontFamily: LucidaBlackletterMX;
              embedAsCFF: false;

  • Robohelp HTML command-line utility overwrites merged files in .hhp file with absolute paths. Any way to prevent this?

    I have a Robohelp 11 HTML project which uses merged CHM files. I have a help build script which compiles this project using the RH command-line utility. Whenever this runs, RH overwrites the names of the merged CHM files in the .hhp file to use absolute paths (even if the .hhp file is read-only!). I've searched Adobe forums and this appears to be a RH bug. In my case, it doesn't stop the project performing the merge, but it looks like it causes problems when searching the resultant parent CHM (topics matching the search simply don't show up in child projects), as the search cannot necessarily find the merged files referenced in the .hhp when someone performs the search on a different machine. I notice that if I compile via the RH UI, the .hhp entries are not overwritten. So, a workaround is to do the build manually. However, we'd like to automate our help build. Is there any way to prevent the command-line compiler overwriting the merge file entries in the .hhp?

    This was a problem with Rh9, see Item 13 at Using RoboHelp 9
    I haven't seen it reported since but maybe something at that link will help.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How to get InputStream from a file with absolute path?

    Hi, guys:
    If I have file with a absolute path that may be inside/outside
    my Eclipse plugin, I want to get an InputStream from it. It just keeps giving me null for "is":
    String absFilePath = "/D:/my_dir/.../sample_file.txt";
    InputStream is = getClass().getResourceAsStream(absFilePath);
    regards,

    Don't use resource as stream if you have an absolute path, use FileInputStream.

  • Images with absolute path no longer viewed in CS3

    I just upgraded from Dreamweaver 8 to Dreamweaver CS3 - In 8
    I could put an images absolute path and view it in Dreamweaver. Now
    when I enter an images absolute path it won't show up while
    viewing....I made sure the image was uploaded to the website - past
    pages that had absolute paths to images can be seen, but new pages
    I create or if I enter an absolute path in older pages, the images
    disapear and I have to work with placeholders..... whats going on?
    Do I have to keep using Dreamweaver 8? (I don't notice any
    difference but I did upgrade the whole suite)

    Hi,
    I also noticed this problem. What I accidently discovered
    that worked for me, is that as long as the characters in the path
    were all together with "no spaces," everything worked fine. I used
    underscores to connect words. I sell on eBay as well as designing
    web sites, so I need DW to generate the code for me to paste into
    eBay's html "code box." So anyway, I would create the web page in
    my DW eBay template, and then upload it to my server. Then I would
    go back to DW, and enter the absolut path(s) for all the pictures
    to my server. As long as the path is connected with no spaces, it
    works.

  • Embeding Fonts in AS3?

    Hello All,
    Publish Settings:
         Program:  Flash Professional CS6
            Target:  Flash Player 11.2
             Script:  Actionscript 3
    So I've created 2 new "Fonts" in my library in order to embed them into my Program. But when I run the program the font is not correct. Not sure
    what I'm doing wrong..?
    Below are the settings for the Embedded Fonts I included. There are 2 of them, which I created by right-clicking in the Library and clicking "New Font".
    The First Font:
                           Name:  "Font_Impact" 
              Char Ranges:  All
           Outline Format:  TLF(DF4)
                    Linkage:
                          -     Checked --->  Export for Actionscript
                          -     Checked --->  Export in Frame 1     (*Don't know if I needed this but it was selected by default..??)
                          -     Identifier --->  Greyed out....
                          -           Class --->  "Font_Impact"
                          - Case Class --->  "flash.text.Font"
                    Sharing:
                             *NOTHING SELECTED HERE (*This was the default so I left it as is)
    The seconds font has the exact same settings as the one above except:
                   Name:  "Font_Arial_Black"
                   Class:  "Font_Arial_Black"
    Now, what I did was I followed the instructions I found here at this link below:
              http://www.gaslightgames.co.uk/?p=163
    I think I did exactly what they did in their example but it didn't seem to work for me.
    My code where I'm trying to use this is:
    import flash.text.TextField;
    import flash.text.Font;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import fl.text.TLFTextField;
        var tickerTxtField:TLFTextField = new TLFTextField();
        //var tickerTxtField:TextField = new TextField();               //---> Tried this one too, same result
     var tickerTxtField_format:TextFormat;        //TextFormat
    var embedFont:Font_Arial_Black;               //Embedded Font 1
    var embedFont2:Font_Impact;                    //Embedded Font 2
    :............OTHER CODE............:
    embedFont = new Font_Arial_Black();
    embedFont2 = new Font_Impact();
    tickerTxtField_format = new TextFormat();
    tickerTxtField_format.font = embedFont.Font_Impact;
    tickerTxtField.text = "This is some sample Text To Display..."
    :............OTHER CODE............:
    I thought I was doing it correctly while I was following the instructions in the link I provided, but I can't seem to get it working.
    Can anyone tell what I'm NOT doing correctly? Any thoughts would be greatly appreciated...!
    Thanks in Advance,
    Matt

    Hi,
    I believe this line is the one causing problems:
    tickerTxtField_format.font = embedFont.Font_Impact;
    I guess it should be:
    tickerTxtField_format.font = embedFont.fontName;
    You actually want to use the property 'fontName' of the Font class, not substitute it for the name of your font.
    Hope it helps,
    Marcel

  • Problem with absolute path and context using Tomcat 4

    I added the following line to my server.xml:
    <Context path="/track" docBase="track" />Now I have used absolute paths(ex: /includes/css/style.css) throughout my code and it worked when I served my application from the ROOT context but when I moved it to the /track - the paths did not include the new root context.
    So instead of looking at http://localhost/track/includes/css/style.css it still looks at http://localhost/includes/css/style.css.
    Is there any kind of setting I am missing in the web.xml or server.xml? I really would like to be able to use absolute paths relative to the context root.
    Please help! Thanks in advance.
    -Chris

    Hi,
    I am not sure what exactly you are asking but here is my shot. If one tomcat is serving more than one application then the only way for tomcat to know which application to refer is by looking at the context path. Since you have the context path of /track then it should appear in all of your urls being directed to the server (for both servlet and jsp). Since you have used absolute path in all the cases either you will have to change the absolute path or you will have to define them relative (which is a better idea) to a base dir. Hope it helps.
    I added the following line to my server.xml:
    <Context path="/track" docBase="track"
    />Now I have used absolute paths(ex:
    /includes/css/style.css) throughout my code and it
    worked when I served my application from the ROOT
    context but when I moved it to the /track - the paths
    did not include the new root context.
    So instead of looking at
    http://localhost/track/includes/css/style.css it still
    looks at http://localhost/includes/css/style.css.
    Is there any kind of setting I am missing in the
    web.xml or server.xml? I really would like to be able
    to use absolute paths relative to the context root.
    Please help! Thanks in advance.
    -Chris

  • Possible to use embedded font in TLFTextField, with TextFormat?

    I want to be able to dynamically change the font in a TLFTextField to an embedded font (not a device font).  I'm using Flash CS5.
    The only way I've found a TLFTextField will use an embedded font is if the on-stage TLFTextField has been set to use that font through the Flash UI.  The example code I've found online (Font.registerFont etc) all works fine for a TextField, but not TLFTextField.
    Below is a very simple piece of code that I expected to work.  I have a font (Earwig Factory) embedded in my library (as DF4, linkage "Earwig"), and the isFontCompatible trace call prints "true", but still it is using the device font - if I remove the system font from my machine (or view the SWF on another machine) it falls back to Times New Roman.
    Can anyone give a very simple example of a TLFTextField dynamically selecting an embedded font?  Eventually I would like to store my fonts in a separate SWC / SWF, but for now just working out of the Library would be a good start.
    Thanks,
    Grant
    import flash.text.TextFormat;
    import flash.text.AntiAliasType;
    import flash.text.FontStyle;
    import fl.text.TLFTextField;
    import flash.text.engine.FontLookup;
    var format:TextFormat = new TextFormat();
    format.font = "Earwig Factory"
    trace("Earwig Factory isFontCompatible: " + tf.isFontCompatible("Earwig Factory", FontStyle.REGULAR) );
    tf.defaultTextFormat = format;
    tf.embedFonts = true;
    //tf.antiAliasType = AntiAliasType.ADVANCED;
    tf.setTextFormat(format);
    //tf.textFlow.fontLookup = FontLookup.EMBEDDED_CFF;

    Ok, I have some success - I can get an on-stage TLFTextField to dynamically use an embedded font.  However, this is quite complex, and doesn't use a TextFormat.  And is this seriously the way Adobe intends us to do it - if so perhaps this should be documented better?
    import fl.text.TLFTextField;
    import flashx.textLayout.formats.TextLayoutFormat;
    import flashx.textLayout.elements.TextFlow;
    import flash.text.TextFormat;
    import flash.text.AntiAliasType;
    import flash.text.FontStyle;
    import flash.text.Font;
    import flash.text.engine.FontLookup;
    import flashx.textLayout.edit.ISelectionManager;
    import flashx.textLayout.edit.EditManager;
    import flashx.textLayout.edit.SelectionState;
    var updateTF:TLFTextField = stageTF;
    var applyFont:Font = new Earwig();
    updateTF.embedFonts = true;
    var tlfFormat:TextLayoutFormat = new TextLayoutFormat();
    tlfFormat.fontFamily = applyFont.fontName;
    tlfFormat.fontLookup = FontLookup.EMBEDDED_CFF;
    updateTF.textFlow.invalidateAllFormats();
    updateTF.textFlow.hostFormat = tlfFormat;
    var prevManager:ISelectionManager = updateTF.textFlow.interactionManager;
    var editManager:EditManager = new EditManager();
    var sel:SelectionState = new SelectionState(updateTF.textFlow, 0, updateTF.text.length);
    updateTF.textFlow.interactionManager = editManager;
    editManager.applyLeafFormat(tlfFormat, sel);
    updateTF.textFlow.interactionManager = prevManager;
    updateTF.textFlow.flowComposer.updateAllControllers();

  • App.open(file) fails even with absolute path.

    Hi There,
    I am new to scripting for AE so please go easy on me.  I have these two lines in a script which is a plain text file with .jsx as the extension.
    var project = new File("C:\path\to\my\project.aep");
    app.open(project);
    So then, I go to my command line and enter this.  I should note that I added the directory containing afterfx.exe to my environment path (I am running Windows 7).
    afterfx -s myscript.jsx
    When i hit enter, AE launches, but I get an error that says:
    Unable to execute script at line 1.  After Effects error: Unable to call "open" because of parameter 1.  Path is not valid.  Path: C:\Program Files\Adobe\Adobe After Effects CS5\Suppor Files\pathtomyproject.aep
    What?!  Why does it think my aep file is within the Support Files directory?!  Is it because of the path environment variable I setup?  Any tips to force AE to find the file I specified in the new File() method?
    Thank you for any advice and your time!

    Hi,
    You need to use double backslashes in the path, like so:
    var project = new File("C:\\path\\to\\my\\project.aep");
    /Ludde

  • How can I embed a video with absolute path into a PDF

    I'm having some difficulties in embedding a video into a pdf; I followed the instructions to embed it properly, but the path points to my personal computer , so that the video will be available only on the computer I used to embed the document.
    Any suggestion? Can I modify the path directly? The PDF is supposed to be linked to another interactive PDF and to work both online and offline.
    Thanks!

    Thanks for the reply. I tested the file on other computers, though, and it doesn't open the video on any computer but mine (mine: the one I used to embed the video).
    Am I doing something wrong? I'm using Acrobat X and the procedure I'm following is: Multimedia/Add Video/Choose file
    I searched for manuals online and I saw that some of them were checking the box "embed file", but I don't have that choice..
    Maybe I'm supposed to use another version of acrobat?

  • Accessing folders with absolute path having chars 256

    Hi, while writing a program that recurses through the dirs and subdirs to find the size of folders tha abs path to the folder became > 256 chars and I got "can't access this folder; path is too long" message. please suggest any workaround for this problem except renaming the parent folders to shorten the path length.

    I am working on Win2K and the part of code is :
    for(int i = 0; i < listFolders.length; i++){ //throws NullPointerException here
                          if(listFolders.isDirectory()){
              mytasks.add(listFolders[i]);
              }else if(listFolders[i].isFile()){
                                  size += (listFolders[i].length())/1000; //modified here- convert to KB
                                  countFiles++;
              if(listFolders[i].lastModified() > max){
              max = listFolders[i].lastModified();
                   fileName = listFolders[i].getAbsolutePath();
    Message was edited by:
    ravishakya
    Message was edited by:
    ravishakya

  • Problems in CS3 and AS3 with embedded fonts

    Hi. I recently downloaded the trial version of CS3 to test it
    out. I'm an experience AS2 developper, and have 10 years of C, C++,
    C#, Java, PHP ... programming experience on BIG projects before
    starting flash.
    I have been trying to use an embedded font in AS3 with a
    dynamically created textfield. I've tried all the examples in
    O'Reilly's ActionScript 3.0 Cookbook. They suggest using the
    [Embed] meta tag, but quite honestly it does nothing in CS3. I had
    the Size Report option selected, and it shows clearly by the file
    size the font isn't present in the SWF.
    Then I tried doing it the way I did in Flash 8. Again there
    no luck. My TextField exists, but there is simple no font being
    rendered.. Here is my bit of code.
    In my library I have a symbol called arialBold. In the
    linkage settings, I have "Export for ActionScript" checked, and
    "Export in first frame" checked. The class is "arialBold" but I
    wonder if that's right? and the Base class is "flash.text.Font"
    I tried every variation I could think of. I must be doing
    something wrong. You can find my file here :
    http://www.newcommerce.ca/as3/fonttest.fla
    Thanks for your help! If you can fix this, i'll be very
    happy!

    this code works
    var tf:TextField = new TextField();
    var tfor:TextFormat = new TextFormat();
    tfor.font = new _TrebushetMS().fontName;
    tfor.italic = true;
    tf.width = 300;
    tf.height = 200;
    tf.embedFonts = true;
    tf.border = true;
    tf.defaultTextFormat = tfor ;
    tf.text = "this is a test";
    this.addChild(tf);
    This code does not work
    var tf:TextField = new TextField();
    var tfor:TextFormat = new TextFormat();
    tfor.font = new _TrebushetMS().fontName;
    tfor.italic = true;
    tf.width = 300;
    tf.height = 200;
    tf.embedFonts = true;
    tf.border = true;
    tf.setTextFormat(tfor) ;
    tf.text = "this is a test";
    this.addChild(tf);
    i don't know why

  • Embedded fonts display differently in mx and spark

    Hi there,
    My apologies if this is an known issue but I have not been able to find any posts describing this problem. As the title of the discussion describes the problem I see is that when embedding the same font for spark and mx components they display differently to the point of making the application look sloppy. I created a small app to illustrate the problem:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        minWidth="955" minHeight="600"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Style>
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/mx";
    @font-face
    src:url("arial.ttf");
    fontFamily: arialCFF;
    embedAsCFF: true;
    @font-face {
    src:url("arial.ttf");
    fontFamily: arialNoCFF;
    embedAsCFF: false;
    advancedAntiAliasing: false;
    s|Label
    fontFamily: arialCFF;
    fontSize: 20px;
    mx|Label
    fontFamily: arialNoCFF;
    fontSize: 20px;
    </fx:Style>
        <s:layout>
            <s:VerticalLayout
                paddingLeft="10"
                paddingTop="10"/>
        </s:layout>
        <s:Label text="This is a label that uses spark"/>
        <mx:Label text="This is a label that uses mx"/>
    </s:Application>
    I used the Arial.ttf font I found in my mac, though I have also tried with courier new and even the myriad web pro provided with an example in the SDK. Also I have tried with SDKs 4.1, 4.5 and 4.5.1. I have played with the value of advancedAniAliasing as well. Regardless of the combination I will still see differences such as this:
    Is this a known issue? Any solutions at hand?
    Thanks in advance for the help!!

    Hi there,
    Thanks for the quick reply. I was able to make fonts display correctly after hacking the display of some components (mx.controls.FormItem for example) however I did notice a whole buch of runtime warnings that showed up as a result of the workaround such as:
    warning: incompatible embedded font 'arialCFFFont' specified for mx.core::UITextFormat. This component requires that the embedded font be declared with embedAsCFF=false.
    TextFieldAutomationHelper:captureSelection() - 'selectionBeginIndex' is not implemented in FTETextField.
    And in some cases for components I do not even use:
    warning: incompatible embedded font 'arialCFFFont' specified for mx.controls::TextInput (TextInput1967) . This component requires that the embedded font be declared with embedAsCFF=false.
    Any ideas on how to avoid this noise or do we have to live with this?

Maybe you are looking for

  • Bill of material for goods receipt

    Hi we have created one BOM which contains some components. when we create  a po & as well as receive the material w.r.t P.o the system is only accepts the main (parent mat) material not its components. Is there any way to receive at a time for parent

  • Vituele schijf in win 8.1 prof.

    Kan ik een virtuele harde schij aan maken in widows 8.1 proffesional

  • Magic trick to make Cinema Display see a closed Macbook?

    Setup: Macbook (computer) 23" Cinema Display (monitor) USB Apple KB / Mouse (kb/mouse) I've never been able to make sense of when the display can "see" the Macbook and vice versa. Sometimes I plug the video cable in for the display and it turns on, I

  • Template for Customized Reports

    Where will I find templates for customizing forms and reports in OraApps11i.

  • How to set inputZ for control inputs ie: strobe, pfix?

    RE: PXI-6551  Need to configure input control for inputZ (50/10k).  ex:  My app. requires strobe input and pfi 2 (input) to have 50 ohm input impedances. Default is 10k.  Property node for input impedance doesn't like "STROBE or PFI 2" etc.