Particle System Boundaries

Hello,

I’ve made a particle system snow globe and right now I have snow blowing across the stage, but I want to have the snow blow around only within the snow globe which is placed in the middle of the stage. I made a movie clip (area_mc) that I want to use as the boundary for where the particles can float.

How would I go about that? Thanks a lot.

My code in my sub-class actionscript file reads:

public function SnowFlake(hz:MovieClip) { //globe:MovieClip) {
// constructor code
hitzone = hz;
//area_mc = globe;
numFlakes++;

		addEventListener(Event.ENTER_FRAME, increase);
	}

	public function increase(ev:Event):void{
		var flake:MovieClip = MovieClip(ev.target);
		flake.xvel += Math.random() * 1 - 0.5;
		flake.yvel += Math.random() * 1 - 0.5;
		flake.x += flake.xvel;
		flake.y += flake.yvel;
		
		if( hitzone.hitTestPoint(flake.x, flake.y, true) ){
			flake.filters = [];
			flake.removeEventListener(Event.ENTER_FRAME, increase);
			
		}
		/*if( area_mc.hitTestPoint(flake.x, flake.y, true) ){
			flake.xvel += -1;
			flake.yvel += -1;
		}*/

Why not use the clip as a mask?

Hi EastCoast, that would be a great idea. But I can’t figure out exactly how to implement the mask. Could you help?

THanks a lot, I appreciate it.

Create the flakes as children of a container movieclip, then for example:

container_mc.setMask(mask_mc);

I’m having a lot of trouble here…I need my snowflakes to only float around in area_mc (my snow globe). Right Now I have all my flakes floating around the entire stage. I do not know how to implement the container mask.

Any help would be great…

public function SnowFlake(hz:MovieClip, globe:MovieClip) {
// constructor code
hitzone = hz;
area_mc = globe;
numFlakes++;

		addEventListener(Event.ENTER_FRAME, increase);
	}

	public function increase(ev:Event):void{
		var flake:MovieClip = MovieClip(ev.target);
		flake.xvel += Math.random() * 1 - 0.5;
		flake.yvel += Math.random() * 1 - 0.5;
		flake.x += flake.xvel;
		flake.y += flake.yvel;
		
		if( hitzone.hitTestPoint(flake.x, flake.y, true) ){
			flake.filters = [];
			flake.removeEventListener(Event.ENTER_FRAME, increase);
		}
		
		if( area_mc.hitTestPoint(flake.x, flake.y, true) ){
			flake.xvel += -1;
			flake.yvel += -1;
		}
		
	}