# Understanding properties

**URL:** <https://forum.kirupa.com/t/understanding-properties/320949>\
**Category:** flash\
**Created:** [April 6, 2011, 3:05pm UTC](https://forum.kirupa.com/t/understanding-properties/320949 "2011-04-06T15:05:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fs\_tigre](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@fs\_tigre](https://forum.kirupa.com/u/fs_tigre)\
**Post date:** [April 6, 2011, 3:05pm UTC](https://forum.kirupa.com/t/understanding-properties/320949/1 "2011-04-06T15:05:38Z")

</div>

> var myArray:Array = new Array();

for (var i=0; i\<10; i++){  
var p:Particle = new Particle();  
p.x = stage.stageWidth / 2;  
p.y = Math.random() \* 400;  
p.xVel = Math.random() \*11 - 6;  
p.yVel = -20;  
p.yAcc = 1;  
p.alpha = Math.random () \* 1 + .5;  
p.scaleY = scaleX = Math.random () \* 2 + .1;  
addChild(p);  
myArray.push(p);  
}

addEventListener(Event.ENTER\_FRAME, moveParticles)

function moveParticles (event:Event):void{  
for (var j=0; j\<10; j++){  
myArray[j].x += myArray[j].xVel;  
myArray[j].y += myArray[j].yVel;  
myArray[j].yVel += myArray[j].yAcc;  
}  
}  
Hi,

I have the above code which creates a simple particle system.  
I created this with the help of people form this forum and I understand  
everything except one thing…

> myArray[j].x += myArray[j].xVel;  
> myArray[j].y += myArray[j].yVel;  
> myArray[j].yVel += myArray[j].yAcc;  
> why ?

> myArray[j].x += myArray[j].xVel;  
> myArray[j].y += myArray[j].yVel;  
> and not just…?

> myArray[j].x += xVel;  
> myArray[j].y += yVel;  
> Also how does myArray know what to do with the property yVel, if all  
> it is is a number that was assigned to “p”? Couldn’t this be just

> yVel += yAcc;  
> why assign it as a property to each  
> “p” in the array?

Can someone help me understand this concept? I believe this is part of OOP where properties are assigned to objects but I just don’t see it here.

Thanks a lot!
