Flashers:
I have inherited a flash file with the wrong "instance of" value in the
Properties panel for the instance of one symbols. How should I change
that to the correct value, /in-situ/? Back-doors, internal ActionScript,
decoding raw FLA files, all are preferable to deleting these objects and
breaking all their links!
It's the Swap button...
Now how do I do it for each of a long sequence of keyframes?
Using the following feeb attempt at JSFL:
var the_doc = flash.getDocumentDOM();
var q = the_doc.library.findItemIndex("art/man_obj");
var man_obj = the_doc.library.items[q];
var q = the_doc.library.findItemIndex("art/swords");
var swords = the_doc.library.items[q];
var tl = man_obj.timeline;
for(var l=0; l < tl.layers.length; l++) {
var the_layer = tl.layers[l];
if (the_layer.name == 'sword') {
fl.trace(the_layer.name);
for(var f=0; f < the_layer.frames.length; f++) {
var the_frame = the_layer.frames[f];
for (var e = the_frame.elements.length; e--;) {
var elem = the_frame.elements[e];
if (elem.elementType == 'instance' &&
elem.instanceType == 'symbol' &&
elem.libraryItem.name == 'art/sword_1')
{
elem.libraryItem = swords;
}
}
}
}
}
Code tips or links to similar published libraries welcome!
--
Phlip
http://www.oreilly.com/catalog/9780596510657/
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders