MovieClip.prototype.searchClip = function() {
var j;
for (j in this){
if (this[j] instanceof MovieClip) {
trace (j);
this[j].searchClip();
}
}
}
_root.searchClip();
The problem is that it only goes into the first movieclip and then inside that goes into the first one it finds again. I need to loop thru all movieclips that lies on my scene, and if it’s posible I need to loop thru all frames as well.
Is it posible to loop thru the library instead ? and no, I can’t do it with jsfl becouse I need to do it when the site is live!
I used this to control stuff in loaded movies, maybe it can work for you
function DoAll(container, func) {
containerfunc;
for (var obj in container) {
if (typeof (container[obj]) == “movieclip”) {
container[obj]func;
for (var mob in container[obj]) {
if (typeof (container[obj][mob]) == “movieclip”) {
container[obj][mob]func;
}
for (var dab in container[obj][mob]) {
if (typeof (container[obj][mob][dab]) == “movieclip”) {
container[obj][mob][dab]func;
}
}
}
}
}
}
//example of use
DoAll(_root, “stop”);
hmm, when I run it and makes some traces inside it have the same problem as the first script, it doesnt run thru all movieclips, just the firstone inline all the time, skipps the rest.
I think it’s becouse the for loop is replaced when going into another clip!!!
hmm, very strange, but don’t you just get down in 3 levels as well ???
the thing that I schould do is to change textfields so they don’t have anything embedded. is it posible somehow to change this in prototype or something ???
yes, for more levels add more loops.
maybe something like this would work but not sure
function DoAll(container, func) {
for (var obj in container) {
if (container[obj] instanceof Textfield) {
container[obj]func;
}
for (var mob in container[obj]) {
if (container[obj][mob] instanceof Textfield) {
container[obj][mob]func;
}
}
}
}
TextField.prototype.nofonts = function() {
this.embedFonts = false;
};
DoAll(_root, “nofonts”);
again you would have to add more loops.(Doesn`t seem such an efficient way)