Here's one I used before. It exports the text itself rather than the fields
(I was using it to get the text into a spreadsheet), but you should be able
to adapt it to your needs.


function findAllText(tTimeline, tPath) {
        var tArray=new Array()
        var tText=""
        var tRuns=0
        var tOpening=""
        var tClosing=""
        var tRun=0
        for (var i=0;i<tTimeline.layers.length;i++) {
                var tLayer=tTimeline.layers[i];
                for (var j=0;j<tLayer.frames.length;j++) {
                        var tFrame=tLayer.frames[j];
                        for (var k=0;k<tFrame.elements.length;k++) {
                                var tElement=tFrame.elements[k];
                                if (tElement.elementType=="instance") {
                                        if (tElement.instanceType=="symbol") {
                                                var tLib=tElement.libraryItem;
                                                if (tLib.itemType=="movie
clip"||tLib.itemType=="component"||tLib.itemType=="button") {
                                                        
tArray=tArray.concat(findAllText(tLib.timeline,tPath+" "+i+" "+j+"
"+k));
                                                }
                                        }
                                } else if (tElement.elementType=="text") {
                                        tText=""
                                        tRuns=tElement.textRuns
                                        for (var r=0;r<tRuns.length;r++) {
                                                tOpening=""
                                                tClosing=""
                                                tRun=tRuns[r]
                                                tAttrs=tRun.textAttrs
                                                if (tAttrs.bold) {
                                                        tOpening=tOpening+"<B>"
                                                        tClosing="</B>"+tClosing
                                                }
                                                if (tAttrs.italic) {
                                                        tOpening=tOpening+"<I>"
                                                        tClosing="</I>"+tClosing
                                                }
                                                if 
(tAttrs.characterPosition=="subscript") {
                                                        
tOpening=tOpening+"<SUB>"
                                                        
tClosing="</SUB>"+tClosing
                                                } else if 
(tAttrs.characterPosition=="superscript") {
                                                        
tOpening=tOpening+"<SUP>"
                                                        
tClosing="</SUP>"+tClosing
                                                }
                                                
tText=tText+tOpening+tRun.characters.split("\r").join("<BR>")+tClosing
                                        }
                                        tArray.push(new Array(tText,tPath+" 
"+i+" "+j+" "+k));
                                }
                        }
                }
        }
        return tArray
}

Danny

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to