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" <[email protected]>
To: "Flash Coders List" <[email protected]>
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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders