473,749 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with animated movieclip

15 New Member
hi,

i would like to make a animated ball from one side to another side and viseversa but when i am running this code only once my ball is running but not second time.

please help





onClipEvent (load) {
speed = 10;
xpos = this._x;
}
onClipEvent (enterFrame) {
trace(this._x);
if (this._x<=550) {
this._x += speed;
if (this._x>500) {
speed = -speed;
}
}
}
Aug 6 '07 #1
1 1034
ashsa
45 New Member
hi,

i would like to make a animated ball from one side to another side and viseversa but when i am running this code only once my ball is running but not second time.

please help





onClipEvent (load) {
speed = 10;
xpos = this._x;
}
onClipEvent (enterFrame) {
trace(this._x);
if (this._x<=550) {
this._x += speed;
if (this._x>500) {
speed = -speed;
}
}
}

The trace you have used should ve shown you clearly that the ball does nt move once it reaches 500.
May be this could help :

Expand|Select|Wrap|Line Numbers
  1.  
  2. onClipEvent (load) 
  3. {
  4.     speed = 10;
  5.     forward=true;
  6.     xpos = this._x;
  7. }
  8. onClipEvent (enterFrame) { 
  9.     trace(this._x);
  10. if(forward)
  11. {
  12.      if (this._x<550){
  13.         this._x += speed;
  14.      }
  15.      else
  16.         forward=false;
  17. }
  18. else
  19. {
  20.      if (this._x>0){
  21.         this._x -= speed;
  22.      }
  23.      else
  24.          forward=true;
  25. }
  26.  
I have nt tested but hope the logic works. Is this wat you are looking for ?
Aug 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6741
by: Altman | last post by:
I have a object that contains a check box. When the value changes it raises an event for that object. I then have another object with a animated gif in it. I linked the event of the first object to change the visible property of the animated gif in the second object. If I click on the checkbox to change it, all works fine. But if I try to change it programatically, (through a timer thread) the image shows up but it does not move. How...
1
4432
by: veenathi | last post by:
i am trying to write code for coping a certain portion of movieclip into another movieclip. for that i draw big stage movieclip. (stage_mc).Then i draw small rectangle movieclips on the stage movieclip. (rect_mc) Now what i want, is that the area of the stage_mc that the rect_mc is drawn on, should be made into another movieclip. So that portion of the stage_mc which had been selected by the rect_mc, becomes a new movieclip newMC_mc. ...
7
14532
by: Lemune | last post by:
Hi.. I am developing an application that connect to database on the other side of the net. And each time i want to connect to database and run some sql command, i want my user to know that there is some process is runing. My idea is to show animated gif until the process is done. My question is how i could achieved that? Any one could give me a clue or hint or even sample code? Thank you? This is my snippet code:
3
1245
by: deepakNagpal | last post by:
hi, i would like to make a animated ball from one side to another side and viseversa but when i am running this code only once my ball is running but not second time. please help
27
14042
by: Phil | last post by:
I thought it would be nice to display some animated GIFs on some of my forms. I put a PictureBox control on a form, and loaded my GIF file in. It animates, but not properly. It seems very jerky and dwells on some frames longer than it should. Searching for this problem, I have found several people who have stated that animated GIFs don't work in a PictureBox at all, and you have to use the ImageAnimator. I assume they must be referring to...
1
9378
by: molle | last post by:
Hi, this is perhaps a common question, but everywhere I just find how to load external images into a movieclip. I have images in my Library that I want to load into a movieclip, so I used attachMovie like this: mc.attachMovie("imagename"); where imagename is the Linkage identifier, but this doesn't work, so I wonder what I am doing wrong?
7
2440
by: rusdyrip | last post by:
hi all i want to make Loading Form with animated gif i make like this 'do events formloading.showdialog() 'do events
1
3761
by: ZenQuickZen | last post by:
This is a script for a character that walks in 4 directions. That works fine. I have also added other random movieclip animations for other keystrokes. I want a movie clip to play through when a key is pressed. Right now the movieclip only plays while the key is being held. How do I get it to continue to play even if the key is released? I am not sure if I need to add something to my action script or change it entirely. Here is my script: ...
1
3573
by: chromis | last post by:
Hi, This should be really simple to do and has really got me stumped. I have a movieclip inside a button, the button is called my_btn and the movieclip is called my_movie. What i want to happen is the movieclip goes to frame two when the button is rolled over, so i added this code to test the reference to the button: my_button.onRollOver = function() { trace(this.my_movie); }
2
5352
by: phpuser123 | last post by:
I have my general movie clip called myscene_mc . Inside it I've placed other 2 movie clips called man_mc and insect_mc... Now,my man_mc contains another movieclip which is empty and i call it forward_mc... Now,can I use forward_mc and insect_mc to check if they are intersecting using something like that :: trace(man_mc. forward_mc.hitTest(insect_mc) I hv tried this bt althougn they are intersecting,the output is...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.