# Continuous Movement Tutorial Help!

**URL:** <https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799>\
**Category:** flash\
**Created:** [November 6, 2003, 3:26pm UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799 "2003-11-06T15:26:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shadow4m](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@shadow4m](https://forum.kirupa.com/u/shadow4m)\
**Post date:** [November 6, 2003, 3:26pm UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799/1 "2003-11-06T15:26:45Z")

</div>

how on earth do i make the circles ascend rather than them going left to right in this tutorial:

[http://www.kirupa.com/developer/mx/continuousmovement.htm](http://www.kirupa.com/developer/mx/continuousmovement.htm)

btw, im in DIRE NEED OF HELP!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 6, 2003, 4:32pm UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799/2 "2003-11-06T16:32:15Z")

</div>

Notice all the references made to “\_x”? Especially in the “Generating Movement” section? That means movement along the x axis (think waaaaaaay back to that early math class you slept through) 😉 . Anyway, you need to change any reference to the \_x direction to the \_y direction.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 6, 2003, 4:37pm UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799/3 "2003-11-06T16:37:16Z")

</div>

See Math 101!

Flash should introduce Polar cordinates. Its hard enough returning radians.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 6, 2003, 4:54pm UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799/4 "2003-11-06T16:54:07Z")

</div>

Youll have to change more than the \_x references. The “block” object needs to be placed on the bottom or top part of stage. Also:

```auto
if (this, hitTest(_root.block)) {
		this._y = -1000;//you 'll probably need to change this value
	}

```

Read this

> [SIZE=1]Taken from the tutorial by kirupa[/SIZE]

Find the line of code that you pasted that contains the number -1000. That number represents the number of pixels back the circles will “respawn” after hitting their right buffer (the rectangle). If your animation is wider than 300 pixels, make sure you increase the number -1000 to something greater (less actually) such as -1200.

Increasing that number ensures that you will not have circles that sporadically spawn in the middle of the animation instead of beyond the left edge. There is no factor that you can multiply the width of your movie by to get the magical number. The location of the re-spawn depends on how you scaled the movie; if you scaled down, the chances of your movie clip spawning in the middle of your animation are greater.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 7, 2003, 6:18am UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799/5 "2003-11-07T06:18:44Z")

</div>

Hi,  
I am unable to move my circle inside a rectangular boundary. It is just displaying on the boundary and not inside. Is there any fault in the code. I am unable to figure out. I am new to this AS. Therefore I may be making some blunder. I am inserting the AS on the Movie itself as on the layer it says that Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: Clip events are permitted only for movie clip instances onClipEvent(load).  
I really don’t know where am I wrong.  
onClipEvent(load)  
{ a1=1;  
b1=1;  
a=a1;  
b=b1;  
}  
onClipEvent(enterFrame)  
{  
do{  
if(\_x\<=0){  
a=a1;  
}  
if(\_x\>=550){  
a=-a1;  
}  
if(\_y\<=0){  
b=b1;  
}  
if(\_y\>=400){  
b=-b1;  
}  
\_x+=a;  
\_y+=b;  
}  
while((\_x\>0)&&(\_x\<550)&&(\_y\>0)&&(\_y\<400));  
}  
thanks a lot for your help.  
-agrawal

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2003, 5:38am UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799/6 "2003-11-08T05:38:30Z")

</div>

this needs to be placed on the movieclip you hope to make move not on the first frame of the movie.  
[AS]  
onClipEvent(load)  
{  
direction=a=b=1;  
}  
onClipEvent(enterFrame)  
{  
do{  
if(this.\_x\<=0){  
a=direction;  
}  
if(this.\_x\>=550){  
a=-direction;  
}  
if(this.\_y\<=0){  
b=direction;  
}  
if(this.\_y\>=400){  
b=-direction;  
}  
this.\_x+=a;  
this.\_y+=b;  
}  
while((this.\_x\>0)&&(this.\_x\<550)&&(this.\_y\>0)&&(this.\_y\<400));  
}  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 9, 2003, 12:52am UTC](https://forum.kirupa.com/t/continuous-movement-tutorial-help/34799/7 "2003-11-09T00:52:31Z")

</div>

Thank you very much for quick response, 🙂 but it was still displaying the movie(sphere) outside the rectangular boundary. Perhaps because I had put AS on the same frame.  
But I used the following code and it is working fine. I didn’t know that flash repeatedly executes the code till you ask it to stop. Therefore I removed the “do while” statement and now it is working fine. my circle dia is 50 that’s why I am substracting 25 and adding 25 to check whether it is touching the boundary of the rectangular area. a1 and b1 I have defined outside so that at any point I want to change the speed of the movie I don’t have to go inside the program and change it everywhere. Now it is really becoming fun to me as I just moved a sphere around a text(over and beneath without using mask layer, instead \_alpha) and it looks real neat. Now I am going to make text 3D in paintshop or fireworks. :crazy:

```
a1=2;
b1=5;
a=a1;
b=b1;

```

}  
onClipEvent(enterFrame)  
{  
if(\_x-25\<=0){  
a=a1;  
}  
if(\_x+25\>=550){  
a=-a1;  
}  
if(\_y-25\<=0){  
b=b1;  
}  
if(\_y+25\>=400){  
b=-b1;  
}  
\_x+=a;  
\_y+=b;

}
