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
btw, im in DIRE NEED OF HELP!
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
btw, im in DIRE NEED OF HELP!
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.
See Math 101!
Flash should introduce Polar cordinates. Its hard enough returning radians.
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:
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.
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
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]
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;
}
:: Copyright KIRUPA 2024 //--