Image

onClipEvent scummy-ness

Hi there, I'm having a little trouble trying to work
code. I will now explain.
I'm generating 20 lines on the stage in random positions and I'd like
them all to have the function rotateClockwise() on them as an
onEnterFrame action. I have tried many ways to figure out how to place
on onClipEvent handler onto a created movie clip unsuccessfully. All
comments greatly appreciated. The code is as follows.







for (i=0; i<20; i++) {

xCo = random(400);

yCo = random(400);

_root.createEmptyMovieClip("line"+i, i);

_root["line"+i].lineStyle(4, 0xFF0000);

_root["line"+i].moveTo(xCo, yCo);

_root["line"+i].lineTo(xCo+10, yCo+10);

//The following line is what I'm unsure about.

//_root["line"+i].rotateClockwise();

//__________

//If I use the following, the entire stage rotated but doesn't even repeat :P

//_root["line"+i].onEnterFrame = _root.rotateClockwise();

}

function rotateClockwise() {

this._rotation += 5;

}




Cross posted on The Live Journal Flash Community.