PDA

View Full Version : for loop messin this up



nobody
May 28th, 2003, 04:01 PM
for (i=0; i<15; i++) {
on (rollOver) {
var colorful = new Color("_root.particle"+i);
colorful.setRGB(0xFF0000);
}
}

any clue why that does absolutely nothing? It's on a movieclip.. just so you know.. I can't figure out what to do

nobody
May 28th, 2003, 04:37 PM
here is the .fla so far
.fla (http://www.xxviii.net/random/virus.fla)

Also, can someone take a took at the "shadow" layer and tell me whats goin on with it?
thanks a lot

eron19
May 28th, 2003, 05:05 PM
i opened ur fla, but every time i tested it, it opened another file and the fact taht it was named virus.fla made me a little uneasy. but anyway....you have syntax errors, for one. so fix those. im done w/your funny file. :)

ahmed
May 28th, 2003, 05:08 PM
hm.. try this:
for (i=0; i<15; i++) {
on (rollOver) {
this["colorful"+i] = new Color(this["_root.particle"+i]);
this["colorful"+i].setRGB(0xFF0000);
}
}

one thing i dont get though,, what object are the 'on(rollOver)' actions assigned to?

nobody
May 28th, 2003, 08:04 PM
the rollovers are supposed to apply to the actual particles.. just couldnt figure out how to do it..
ill test that later

eron.. yeah i figured that was a bad name but i was too lazy to rename it.. so pretend it says bacteria.. btw, i fixed the syntax errors like 2 seconds after i posted it cuz im an idiot;)

ahmed
May 28th, 2003, 08:10 PM
try this then :)

for (i=0; i<15; i++) {
this["_root.particle"+i].onRollOver = function() {
this["colorful"+i] = new Color(this["_root.particle"+i]);
this["colorful"+i].setRGB(0xFF0000);
}
}

nobody
May 28th, 2003, 08:22 PM
says i need an onClipEvent handler.. but I never know how to fix that.. here comes another fla
also, can you check out my "shadow" layer.. I'm tryin really hard to make that work but i dont know what I'm doin wrong
bacteria (http://www.xxviii.net/random/virus.fla)