Newbie question

Hi guys,

I have a movie right now that has a preloader that then moves to the next frame where I want a line to scroll down the screen until a certain point and then stop and center itself (as well as stretch across the screen).

I am running into a few problems though, and the line keeps scrolling down the screen. This is the code I’m trying to use:

onClipEvent (enterFrame) {
speed = 2;
if(this._y != 395) {
this._y += speed;
}
this._x = 700 /2;
this._width = 700;
}

Which is a modification of the movement tutorial on this site. What I’m getting now is just the line growing to be the screen width and centered, but it just keeps of scrolling down. How can I make this work and stop at the y coordinate 395?

Thank you very much,

Lior

hi,

you have to create an interval, because you’ll never be able to assure that the movie clip’s _y will be 395:


onClipEvent (load) {
	speed = 2;
}
onClipEvent (enterFrame) {
	if (Math.abs((this._y - 395)) > 2) {
		this._y += speed;
	}
	this._x = 700 / 2;
	this._width = 700;
}

that can be easily veryfied using a trace action:


trace(this._y);

Great!! Thanks. Another thing is how do I create a sequence of events? Let’s just say now that I have the lines now moving into their appropriate positions, and then I create another layer with a keyframe (right after the frame where I have the lines move). Now I want to create a color block that will fade into view from _alpha = 0 to 100.

I’m trying to do this now and am getting the two crossing into each other. The lines don’t finish loading and the box comes in and fades while the lines are still moving.

Thanks again for your time, I really appreciate the help.

Lior

I believe you have to check for a condition…


if(something){
//keep waiting
}else{
//do what you want
}

for example, you code made the mc move. when it finishes moving, something happens…


onClipEvent (enterFrame) {
        if (Math.abs((this._y - 395)) > 2) {
                this._y += speed;
        }else{
trace("stop!");
}
        this._x = 700 / 2;
        this._width = 700;
}

Awesome. Thank you very much.