Hi guys,

I'm trying to solve the shared library, dynamic fonts thing.

I have a shared library with some fonts contained in MovieClips.
Everything has instance names. Everything is set with linkage identifiers and set to export.

In my other FLA I bring the shared library in and access the text format of the text brought in. I then create a text field dynamically and try to set the format gained earlier onto the new field.

But guess what - it does not work.

Any ideas?

(It works if you use the shared library 'properly' eg using File>> Import >> Open External Library, but I do not want to do that - I only want to bring in the fonts as and when required.)

The text has the rough format apart from the font is incorrect. =(

Here's my code. (I've left in all my other attempts)

I've tried to embed and not to embed

Regards

Steve


/////////////////////// CODE //////////////////////////


// import a .swf containing movie clips with dynamic text fields in them with embedded fonts
// the mcs in the Library are set to have;
//  - linkage identifiers
// - export for runtime sharing selected
// - export in first frame seleced



// BASIC LOADING OF EXTERNAL .swf FONT CONTAINING FILE /////////
var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("designer_fonts.swf", container);

function onLoadInit(mc:MovieClip) {
    trace("onLoadInit: " + mc);
        // wait - just in case it's as not fully loaded timing issue
        makeText_INT = setInterval(maketext, 1000)
        changethetext();
}
//////////////////////////////////////////// END OF LOADING /



///////////////////////////////////////////////////////// the guts of it
function maketext(){
        clearInterval(makeText_INT);
        //_level0.attachMovie("ag_medium", "newtext", 150 );
        //trace( "newtext1 = " + _level0.newtext1 );
        _level0.createTextField("newtext", 1, 150, 150, 200, 200 );
        
        // tf = new TextFormat();
        
        // get the format off of the shared text fields
        //var tf:TextFormat = container.ag_book.book.getTextFormat();
        var tf:TextFormat = container.ag_book.book.getTextFormat();
        tf.size = 50;
        //tf.font = "AvantGarde Bk BT";

        
        trace("tf.font = "+tf.font);
        // set the format saved onto the 'vv' text
        // newtext.setTextFormat(tf);
        newtext.autoSize = true;

        newtext.text = "a dynamic field";
        //newtext.embedFonts = true;
        newtext.setTextFormat(tf);
        //newtext.setNewTextFormat(tf);
        for ( var props in tf ) { trace( props + " = " + tf[props]); };

}
/*

this is the trace

onLoadInit: _level0.container
tf.font = AvantGarde Bk BT
letterSpacing = 0
kerning = false
display = block
bullet = false
tabStops =
blockIndent = 0
leading = 2
indent = 0
rightMargin = 0
leftMargin = 0
align = left
underline = false
italic = false
bold = false
target =
url =
color = 0
size = 50
font = AvantGarde Bk BT
getTextExtent = undefined
*/
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to