I’m trying to make a basic particle system and am running into a pretty simple problem I just can’t seem to find the answer to. For some reason none of the particles are moving. Here is my basic code just to start:
onClipEvent (enterFrame) { 
i = 0; 
totalParticles = 10; 
gravity = 1; 
} 
onClipEvent (enterFrame) { 
for (i; i<totalParticles;i++) { 
attachMovie (“particle”, “particle” + i, i); 
_root.emitter[“particle”+i].xSpeed = random(5); 
_root.emitter[“particle”+i].ySpeed = -5; 
_root.emitter[“particle”+i].onEnterFrame = function () { 
ySpeed = ySpeed + gravity; 
this._x += xSpeed; 
this._y += ySpeed; 
} 
} 
}
I’m sure the answer is pretty easy I just can’t seem to see it. Thanks in advance.
             
            
               
               
               
            
            
           
          
            
            
              Fixed :
 
onClipEvent (**load**) {
 i = 0;
 totalParticles = 10;
 gravity = 1;
}
onClipEvent (enterFrame) {
 for (i; i<totalParticles;i++) {
  **_root.emitter.**attachMovie ("particle", "particle" + i, i);
  _root.emitter["particle"+i].onEnterFrame = function () {
**   xSpeed = random(5);
   ySpeed = -5;**
   ySpeed = ySpeed + gravity;
   this._x += xSpeed;
   this._y += ySpeed;
  }
 }
}
 
             
            
               
               
               
            
            
           
          
            
              
                JakeO  
                
               
              
                  
                    August 7, 2004, 12:58am
                   
                   
              3 
               
             
            
              use this code only:
onClipEvent(load)
{
	var totalParticles = 10;
	var gravity = 1;
	
	for (var i = 0; i < totalParticles; i++) 
	{
		attachMovie ("particle", "particle" + i, i);
		_root.emitter["particle"+i].xSpeed = random(5);
		_root.emitter["particle"+i].ySpeed = -5;
		
		_root.emitter["particle"+i].onLoad = function()
		{
			var xSpeed = 0;
			var ySpeed = 0;
		}
		
		_root.emitter["particle"+i].onEnterFrame = function () 
		{
			this.ySpeed = this.ySpeed + gravity;
			this._x += this.xSpeed;
			this._y += this.ySpeed;
		}
	}
}
 
-Jake
             
            
               
               
               
            
            
           
          
            
              
                JakeO  
                
               
              
                  
                    August 7, 2004,  1:00am
                   
                   
              4 
               
             
            
              also random(number) is a depreciated function. use this to achieve the same effect:
_root.emitter["particle"+i].xSpeed = Math.random() * 5
 
             
            
               
               
               
            
            
           
          
            
              
                Dunga  
                
               
              
                  
                    August 7, 2004,  4:14am
                   
                   
              5 
               
             
            
              Here is my version, with dragging and bouncing particles!
http://roy.wigginsworld.org/Particle  System.fla
             
            
               
               
               
            
            
           
          
            
              
                Dunga  
                
               
              
                  
                    August 7, 2004,  4:41pm
                   
                   
              8 
               
             
            
              Its because I was too lazy to tell the forum the whole thing was a link, and I forgot whatever the “code” for a space was… anyway, I’m glad you like it.
             
            
               
               
               
            
            
           
          
            
              
                Gupps  
                
               
              
                  
                    August 9, 2004,  3:49am
                   
                   
              11 
               
             
            
              hi dunga, I can’t find your fla in your site 
by the way cool animation