# Trouble with ParticleBaheaviour.as

**URL:** <https://forum.kirupa.com/t/trouble-with-particlebaheaviour-as/250259>\
**Category:** flash\
**Created:** [January 27, 2008, 8:00pm UTC](https://forum.kirupa.com/t/trouble-with-particlebaheaviour-as/250259 "2008-01-27T20:00:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rita\_g\_caetano](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@Rita\_g\_caetano](https://forum.kirupa.com/u/Rita_g_caetano)\
**Post date:** [January 27, 2008, 8:00pm UTC](https://forum.kirupa.com/t/trouble-with-particlebaheaviour-as/250259/1 "2008-01-27T20:00:10Z")

</div>

Hi everybody, I recently downloaded the ParticleBehaviour.as from [www.senocular.com](http://www.senocular.com), I’m trying to make an object move away from the mouse, everything works fine until I try to constrain the objects movement within a certain space. I’m sure I’m doing something wrong, I’m preety much a newbie in Actionscript…

So, this is the code I have so far:

var avoidBehavior:Function = ParticleBehavior.create(“avoid”, {velocity:20, acceleration:5, friction:.8, range:200, avoid:Mouse});  
var constrainBehavior:Function = ParticleBehavior.create(“constrain”, {bounds:frame.getBounds(), use:“bounds”});  
box.onEnterFrame = ParticleBehavior.multiple(constrainBehavior, avoidBehavior);

“box” is the movieclip I want to move away from the mouse, “frame” is the boundry box.

I’ll appreciate every single word of help by any of you guys
