Muzak and others,

everything worked fine, but now i am struggling with movieclips and different frames on their timeline containing 1 png.
I followed your described logic.
1. go trhrough lib items.
2. Check if it is a movieclip.
3. For framecount of the timeline, do a loop.
4. For each frame get the elemtens
5. add this to the selection
6. apply the trace bitmap.
7. ERROR! Selcection not set

Would someone please be so kind to take a look...it is driving me nuts!

Thnx

<code>
function convert(tFlaPath , tExportPath){
        
        fl.openDocument(tFlaPath);
        
        var doc = fl.getDocumentDOM();
        var library = doc.library;
        var items = library.items;

        i = items.length;

        while (i--) {
        var item = items[i];
        
        if (item.itemType == 'movie clip') {

                var timeline = item.timeline;
                var k = timeline.frameCount;
                
                library.selectItem(item);
                library.editItem();
                
                while(k--){

                        var j = timeline.layers[0].frames[k].elements.length
                        
                        while(j--){
                                doc.selection =  
timeline.layers[0].frames[k].elements
                                doc.traceBitmap(100, 1, 'normal', 'normal');
                        }
                        
                        
                }
                doc.exitEditMode();
                }
                
        
        }
        
                
        filename_new = getNewFileName(filename);
    targetPath = tExportPath + "/" + filename_new.toUpperCase1() + ".swf"
        //doc.exportSWF(targetPath, true);
        //doc.close(false);
}

</code>

Muzak wrote:
This should work, but should probably build in a few more "checks" in the loop. Like check if there's a bitmap in the currently editted movieclip in the specified frame.

What this does is:
- loop through the items in the library
- check if current item is a movieclip (not a bitmap as you did)
- if movieclip, select it and enter edit mode
- get the movieclip timeline and set the elements in its first frame/first layer as document selection
// here is where you should check if the above selection contains a bitmap
- trace bitmap


var doc = fl.getDocumentDOM();
var library = doc.library;
var items = library.items.concat();

i = items.length;

while (i--) {
var item = items[i];
fl.trace("itemType: " + item.itemType);
if (item.itemType == 'movie clip') {
 library.selectItem(item);
 library.editItem();
 var timeline = item.timeline;
 fl.trace("    - frameCount: " + timeline.frameCount);
 doc.selection = timeline.layers[0].frames[0].elements;
 doc.traceBitmap(100, 1, 'pixels', 'normal');
}
}
doc.exitEditMode();


regards,
Muzak

----- Original Message ----- From: "Jiri" <jiriheitla...@googlemail.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Monday, February 09, 2009 9:47 AM
Subject: [Flashcoders] Help jsfl traceBitmap


Hello,

i was wondering if someone can help me out with the following.
I have a the maintimeline with on it a movieclip. Inside this movieclip is a png, that I would like to trace as a bitmap.

I can't seem to target the png that is nested in the movieclip. If i understand correctly I will first need to get it the timeline of the png holder clip from the library and then select the frame. Here is my code which throws a "selection: Argument number 1 is invalid."

var doc = fl.getDocumentDOM();
var library = doc.library;
var items = library.items.concat();

i = items.length;


while (i--)
{
    var item = items[i];
    if (item.itemType == 'bitmap')
    {
        var imageName = item.name.split('.')[0];
        var image = doc.getTimeline().layers[0].frames[0].elements[0];
doc.selection = image
doc.traceBitmap(100, 100 , 'normal' , 'normal');
    }
}

Hope someone can help!

Jiri
_______________________________________________

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to