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 ñ_ñ
- 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.
- 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.
- 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”.
- 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”.
- 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.
- To dynamically load with loadMovie the film of the source.
- 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.
- 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.
- It cannot have in the film created text fields from the IDE (not even static) with the same source that the one that is going away to load. This is so simple because if there is a text field with the same source that the one that has been loaded dynamically, the text fields to which we apply to him the TextFormat of the dynamic source will stop seeing themselves correctly. The form simplest to solve this is to create with createTextField All the text fields that use the dynamic source. This DOES NOT AFFECT the FILMS THAT the MAIN FILM HAS LOADED DYNAMICALLY. To see file fla of Errors/TextoEstatico for demonstration.
- It is not possible to use sources in cursive or bold. I have not been able to use a source in cursive or bold and I have not found another form to solve it. To see file fla of Errors/Cursive for demonstration.
- The text fields must have the source including (campo.embedFonts = true), reason why the source ALWAYS will be smoothed out.
- Problems when doing the preload with the MovieClipLoader class. Using the MovieClipLoader class for the load of the file of the source, I have realized of which the event onLoadInit goes off Before the source is ready to be used. Technically I believe that this would not have thus to be since the reference puts clearly that this event is called after the actions of first frame of the film have been executed. In our case, frames of the loaded film does not work thus since onLoadInit is executed first and soon. In some cases the order has been MovieClip, onLoadInit, Main line, which is still more rare. Why happens this? Then really I do not know it, but I suppose that swf for the export and the import will be a “effect collateral” to use the same. If somebody can clarify this a little to us, will be helpful. The unique form that I have found to solve it is: 1) to hope frame or 2) to create an interval. To see archives fla of Errors/CargaMovieClipLoader and Errores/Draws up for demonstration. [As it is possible to be appreciated in the film of Errors/Draws up, is another method to secure the dynamic sources and consists of replacing the symbol of source of the library by a MovieClip with a text field with the characters including. This can be especially useful when it is not wanted to include all the source but only characters, by examples, only the numbers of preload]
- Incompatibilidades de Player. I have successfully proven the method in players 7 of Windows, Mac and Linux and to player 6.0.79 of Windows. It would be necessary to test intensive because it is probable that of previous problems in players.
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