(Flash MX) Scripting movement and Playing imported SWFs

Hello everyone,

I am new at Action Scripting, so please forgive me if these questions sound ridiculous.

I’ve altered Kirupa’s tutorial on “creating continuous motion” to make lines flash by from left to right. This is what the code looks like:

onClipEvent (enterFrame) {
//generating movement
location = this._x;
var i;
i = 1+_root._xmouse/5;
if (this, hitTest(_root.block)) {
this._x = -500;
} else {
this._x = location+i++;

It works great, but I’d like to alter the code a bit more.

So here is Question 1: How can I make the lines move from left to right independently from the x-axis mouse movement, so that the speed and direction of the lines remain constant? (Right now, a lateral movement of the mouse slows down/accelerates my lines, and can even make them go backward, something I don’t want.)

Question 2:

The file I mentioned above is called “moving_lines.swf.” Another file named “main.swf” calls it into action with this code:


What’s weird is that it plays the flashing lines only once, instead of continuously. I haven’t put any “stop” command anywhere. Can anyone tell me what I am doing wrong?

Thank you very much for your help!