473,699 Members | 2,700 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 1033
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
6737
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
4429
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
14531
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
1244
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
14028
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
9374
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
2438
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
3756
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
3570
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
5346
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
8705
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
8623
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
9197
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...
0
9054
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8941
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
8897
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7785
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5881
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();...
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.