Duplicating power ups

im making a space fighting game vertical scroller
how do i make its so that lets say you get the yellow power up then the green one comes then the red one at a time and in random places
and if you miss it goes to the top again or waits and goes to the top
hope im being clear


onClipEvent (load) {
	function rewet() {
		this._x = random(500);
		this._y = random(10);
		power = random(20);
	}
	rewet();
}
onClipEvent (enterFrame) {
	if (_root.health>=0 ) {
		this._visible = true;
		this._y += power;
		if (this._y>620) {
			rewet();
		}
	}
}
onClipEvent (enterFrame) {
	if (this.hitTest(_root.spaceship)) {
		_root.powerbar.nextFrame();
		removeMovieClip(this);
		p1 = true;
	}
}

i have that on the first power up

onClipEvent (load) {
	function rewet() {
		this._x = random(500);
		this._y = random(10);
		power = random(30);
	}
}
onClipEvent (enterFrame) {
	if (_root.health>=0 and (p1=true)) {
		this._visible = true;
		this._y += power;
		if (this._y>620) {
			rewet();
		}
	}
}
onClipEvent (enterFrame) {
	if (this.hitTest(_root.spaceship)) {
		_root.powerbar.nextFrame();
removeMovieClip(this);
		p2 = true;
	}
}
onClipEvent (enterFrame) {
	if (p1=true) {
		this.rewet();
	}
}

this is what i have on the second but it doesnt work help