Search code examples
actionscript-3flash-cs3jsfl

How to access group members in Flash CS3


I'm writing a script to access all dynamic textfields in the library of a flash (fla) file and embed certain character sets.

I iterate through all objects looking for textfields, but It seems there are some issues when trying to access members of a group object. It does have children in the flash file, but I can see no way to access them from the Group object defined in the CS3 reference for jsfl. Group has an undocumented layer property, among others, but it seems to only contain a reference to itself.

The CS4 reference defines a members property for the Group object.

So my questions is, how do it access the children of a Group object in Flash C3 jsfl script API?


Solution

  • Just unGroup() the shapes first. Then you can run your normal "text" conversion afterwards. It shouldn't hurt the document because grouping has no real technical implications.

    var doc = fl.getDocumentDOM();
    var results = fl.findObjectInDocByType("shape", doc);
    for (var i = 0; i < results.length; i++) 
    {
        if ( results[i].obj.isGroup )
        {
            doc.selection = [results[i].obj];
            doc.unGroup();
        }
    }