0 Replies Latest reply on Oct 21, 2010 5:26 PM by RyanORo

    JSFL: Change element properties inside a library symbol?


      I'm trying to make a JSFL script to scan all the symbols in a library, find the text fields, and set useEmbeddedFonts = true.


      Actually, just backing up a second, assume there are instances on the stage.  Then I can use fl.findObjectInDocByType("text") to find all the text fields and inspect them to see their type, contents, etc.  But if I try to use one of the elements returned by that call to change the useEmbeddedFonts property, nothing seems to happen.


      Something like this:


      var texts = fl.findObjectInDocByType("text", doc);


      if (texts.length > 0) {

          for (var i = 0; i < texts.length; i++) {

                if( texts[i].obj.textType != "static" &&  texts[i].obj.useDeviceFonts == false )


                     fl.trace("Setting text field to use device fonts: " + texts[i].obj.name);


                     texts[i].obj.useDeviceFonts = true;



      It seems to have no effect on the text fields.  They are still set to anti-alias.


      Ok, so assuming that problem can be overcome, to deal with symbols in the library, I was thinking of running through the library items and creating instances of them on the stage, then using the findObjectInDocByType to update them, assuming this will actually change the symbol and not just the instance.  But I don't see how to actually create an instance of a symbol on the stage, which seems like it should be easy.


      Or, is there some other way of introspecting the library symbols to find the text fields and modify them directly?  This would have to handle cases like button symbols where the text field is inside the symbol, not a symbol itself...