Shared Fonts Today

Introduction

The use of typographies shared in Flash never has been a easy task. For 3-4 years it has been tried to solve by several ways, some with better or worse result. This method is not perfect either. It would be well that Macromedia took advantage of the new version Flash to create “a scientific” method that solved this problem once and for all.

To raise

Previous approaches

Previously 2 ways have been tried basically:

1) “Normal” use of shared bookstores.

The use of the shared bookstores implied that the load of the external films did not become through loadMovie, reason why the weight of the source was always loaded in first frame of the film, with the consequent problems of preload. In addition, this system does not allow to take a control you (through a class for the management of the sources, component or something similar) of the sources that already have been loaded.

Another one of the disadvantages of using shared bookstores is that all the films that require the source will make the request of the file swf contains that it, although the file is in the cache of the navigator (whenever we are not in surroundings https or that by any type of reason heads have been used of not-breaks).

2) Dynamic load of films with the sources.

The resolution of the problem that approached which more I I wanted I was the one of Ivan Dembicki with its Shared Font Manager (SFM). But it had a series of problems: 1) is of payment, 2) uses global variables for the definition of the TextFormat objects, 3) uses 2 archives for each source.

To raise

Objective

To create a file swf by each one of the typographies that are going away to share and to be able to load them through loadMovie dynamically as if outside an external file more. The application of the format from text to the new fields must soon be is transparent more possible, avoiding in addition global TextFormat objects.

To raise

Solution

You can bajarte zip with fla (MX 2004) of example.

a) Creation of the films with the sources.

To create a unique film by source was one of my obsessions, since I never understood why it must have 2. In addition when there are 2 films, the complica preload enough since the film that load is not the one that really contains the source. That means that a film was preloaded of, for example, 1kb, when the real property tax could be of 15kb. When only the preload is a film, evidently, he is real.

The solution to this I found it problem by pure chance and I do not believe that is to teach itself it to the children in the school… simply works. In order to know why it works, the best thing is to ask in www.macromedia.com ñ_ñ

  1. To create a new film. Normally I use like name for the file the one of the source that is going to contain. If the name has a space in target I replace, them by “_”. Also it is possible to create a film with several sources, which can be very useful to group sources by projects and to load it all of a single time.
  2. To add a symbol of typography to the library. In order to add it is necessary it to do click in the button of the right part superior of the library and to select “New Font”. We select of the list the source that we wished and we give the name that we want to him, is indifferent. The one of the own source is a good option, simply by organization subjects.
  3. To do click with the right button on the created symbol, to select to the option “for Export runtime sharing” and like URL to put the one of the file swf that turns out to compile the film. That is to say, if we have the file fla “nombre_fuente.fla”, because there would be to put “nombre_fuente.swf”.
  4. To create an empty MovieClip and to give him as it names “ForceShared” (this are a copy than Hall made Branden J.). Arrastralo to the scene. Abrir the library, to do click with the right button on and selecting “to for Import runtime sharing”. In the URL to write the URL that we have defined in the previous step. IMPORTANT: IF the FILE OF the SOURCE AND the FILM IS GOING THAT IT TO LOAD ARE NOT IN THE SAME FOLDER, HAS TO DEFINE THIS ROUTE REGARDING the FILM THAT GOES To CARGAR.Ver example in fla of the archives that is in “DistintaCarpeta”.
  5. To compile. If the route of export and import is not the same, a load error will take place since it will not be able to load the import route. It does not pass anything.

b) Use of the sources.

  1. To dynamically load with loadMovie the film of the source.
  2. To create a TextFormat object and a dynamic text field as if the source was in the library. That is to say, if the source that we want to load is “Quadaptor”, we will have to define the property thus font of the TextFormat: myFomat.font= " Quadaptor”. The text field must include the sources with myField.embedFonts=true.
  3. Enjoy:)

To raise

Problems

Of the same form that anyone of the other methods, this one that I finish also presenting/displaying has incovenientes. I suppose that the election of a method or another one will depend on the needs of each project. These are those that I have found, if véis any other, please mandadme a mail to articles [entrances] zarate.tv it can update so that it.

To raise

Gratefulness

First to thank for all the people who have tried this before, since their works have been the bases of this one. Also to Oscar Perez and Gustavo Branches by its work of investigation and advice when he was already completely desperate: D

It would thank for voluntario/a that translates the article to English, since if I do certainly the one read who it does not remove much benefit:)

To raise

Connections

To raise

Direct link to this article
Suggestions, errors or any doubt on this article in articles [entrances] zarate.tv
More articles in Zarate.tv

To raise

Creative Commons License
This work is licenced to under to Creative Commons Licence.