开发者

JSFL - Flash CS4: replace textfields' font by an embedded font

开发者 https://www.devze.com 2023-01-28 00:02 出处:网络
I have tried a bunch of JSFL scripts to change textfields\' fonts of a fla library. I used those scripts to change textfields\' fonts for an embedded font which do exist in the library. All scripts ru

I have tried a bunch of JSFL scripts to change textfields' fonts of a fla library. I used those scripts to change textfields' fonts for an embedded font which do exist in the library. All scripts run fine through Flash CS3 but always fail through Flash CS4

Let's give an example: replacing the "Arial" font used by all textfields in the fla scene by the "myEmbeddedArial开发者_StackOverflow中文版*" embedded font (symbol). The jsfl font replacement instruction is the following one:

textElement.setTextAttr("face", "myEmbeddedArial*");

I can give a lots of all details about this issue but does someone already observed it and may know about its root cause ?

Thanks

P.S: Note the Find/Replace "Font" feature of Flash CS4 IDE works properly only if the textfields contain not emtpy strings and only if the symbol including this textfield is in a scene and only if you search in "Current Document" (and not in "Current Scene").


I am not sure if it works for you but maybe: http://blog.samueltoth.com/?p=142

Good luck, Rob


I think I found a successful workaround. So the only way to properly do that in CS4 IDE is to use the find/replace function, but the textfields' content must not be empty.

  1. Use your jsfl script to fulfill all empty textfields of your symbol library with a marker string like '####'.

  2. Ensure all the embedded font symbols used on your textfields are in your fla library. Because find/replace tool will not parse the textfields which use some embedded font symbols which don't exist in the library. Indeed some embedded font symbols may have been deleted and/or mapped on a default font (manually or during a file conversion from CS3 to CS4). Especially take care to case sensitivity on the embedded font symbol names.

  3. Create the missing embedded font symbols used on your textfields (with the right case sensitive names) before using find/replace feature.

  4. Create the new embedded font symbols you want to use to replace the old embedded font symbols.

  5. Now you should be able to use find/replace feature of CS4 properly even with embedded font symbols. Open find/replace window. Select "Search in: Current Document" (not in "Current Scene"). Create a new layer on your main scene. Create an instance of all the movie clips you have in your library in this layer (e.g: select all the symbol library then drag & drop the selection in the scene).

  6. Don't forget to remove your '####' string marker from all the textfields by using your jsfl script or the find/replace Text feature of the IDE. Finally delete the layer you created for the font replacement operation and all the symbol instances in it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号