PDA

View Full Version : Forcing font symbol in library to load after first frame ?


bitterclarence
03-23-2003, 03:49 PM
hello, so far i havn't been able to find any information on this, i hope someone here can give me a hand.

In my movie i'm creating text fields dynamically and populating them with text that uses an embedded font.

I've got a font symbol in my library with a linkage id, with export in first frame checked.

Everything works fine. But now i need to optimise my movie, there's too much stuff loading in the first frame (before it gets to the preloader).

i'd to force my font symbol to load after the preloader, and still be able to use it to create dynamic text fields programatically.

But i don't know how to do it!

(i know i can place textfields manually at authoringtime and embedd the font in them.. but then the font doesn't have a linkage id.. so i can't use it with AS)

does anyone know a good approach to this?

Mortimer Jazz
03-23-2003, 04:36 PM
You could use a workaround - have a preloader file that loads in your movie(s). This way you can ensure that the preloader will always load first as it would be a completely different movie.

toddyard
03-24-2003, 02:39 AM
Unfortunately, if you have a font symbol exported from your library, it ALWAYS loads in the first frame even if you deselect that option. The workaround is to NOT export a library font symbol but instead place a dynamic textfield on the stage with its font (or whatever characters you need) embedded. This has two advantages. First, you can pick which frame the font loads into the player (by whichever frame you place the textfield in), PLUS you can limit the characters embedded, and thus reduce filesize.

By the way, there is an ..um.. FEATURE of Flash MX that if you have an embedded font in another level, you HAVE to have the font embedded in the base movie as well, else it won't appear. This means that only having a preloader in the base movie and loading the font in dynamically doesn't work.

bitterclarence
03-24-2003, 09:14 AM
thanks for your responses,

toddyard: i came to pretty much the same conclusion myself. Until now i wasn't aware that it was possible to reference a font through actionscript if that font symbol wasn't in the library.

So i've created a situation like you described, the 'parent.swf ' has hidden text fields with my font embedded on it's time line (these were placed manualy at authoring time).

Then, the 'child.swf' (that gets loaded into parent.swf) can use the font to format dynamically generated in AS. Child.swf creates a textformat object that references the font name used in parent.swf (just the 'natural' font name, you don't need to use a linkage id.. i was surpised my this!).

Incidentally, re. the issue that you mentioned about fonts having to 'exist' in the base movie of any clip that needs to use them (ie. it's not enough to make sure that a font exists in the timeline of the movie that uses it, if that movie is loaded into a parent clip). This also seems to be the case if you use loadMovie() to bring in the child clips (as well as affecting the level-loading approach as you mentioned).

Mortimer Jazz
03-24-2003, 09:46 AM
Originally posted by toddyard
By the way, there is an ..um.. FEATURE of Flash MX that if you have an embedded font in another level, you HAVE to have the font embedded in the base movie as well, else it won't appear. This means that only having a preloader in the base movie and loading the font in dynamically doesn't work.

I would like to see an exmaple of this (can you attach one?). It's not something I've found.

My base movie contains nothing other than a loadMovie command. I'm using an 8pt pixel font that 'must' be embedded (otherwise it appears as 8pt Times New Roman) and people are seeing it without any problems.

I was also under the impression that if you're loading external swfs into levels (as opposed to loading them into movieclips within a main swf) the font will be loaded in each time (not something I'd bet my life on though), but yes, if you're loading swfs into movieclips in a main movie you should be able to utilise the existing font.

toddyard
03-24-2003, 10:00 AM
I'll create an example situation and post back. There's the possibility that this has been fixed in newer players, but I know it was an issue when MX and the Flash Player 6 came out.

bitterclarence
03-24-2003, 10:00 AM
mortimer: i think this issue only applies if your trying to reference a font through AS, is this what you're doing in your files?. These steps should (hopefully) demonsrate the problem..

1. Don't include the font outline in your base movie..

2. Do include it in the library of the child movie and give it a linkage id

3. Create a textfield and textformat object in AS inside the child movie, create some text and try to apply the Font that you've got in the child's library.

4. If you run the base movie, (i think) that the child movie won't work as expected.. the text that you've tried to apply the font to wont show up.

sense? :)

Mortimer Jazz
03-24-2003, 10:14 AM
Ah, no that;s not what I'm doing at all!
...but it is something I plan on doing when I get around to my form. I stopped using shared fonts after the initial Flash 5 debacle. The last thing I read was Brandon Hall's summation of them for MX (which wasn't good either) :rolleyes:

Cheers guys, this is interesting to know :)

toddyard
03-24-2003, 10:38 AM
Thanks for explaining it, bitterclarence. And Mortimer Jazz, yes indeed it does mean that the font will be loaded *each* time (for each level using it). It's not a good thing, and hopefully will be fixed with the next version.

Mortimer Jazz
03-24-2003, 10:42 AM
btw toddyard, 27bobs has been in my favourites list for ages. First saw it when I was in Dublin and pointed it out to my boss as a great example of flash. Great to see your a member here :)

toddyard
03-24-2003, 10:46 AM
:)

bitterclarence
03-24-2003, 10:53 AM
hey it's you! i agree, that's an excellent site!

just as a side note to this font business. One of my old FFF fonts wasn't displaying properly using the technique described above ('FFF Star'). I downloaded the latest update of the font from the FFF site and now it works fine.