• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

Keeping this actionscript aimed over certain area?

How would i keep a actionscript generated partical effect over a cetain area on the stage. I understand how to move it about on the stage but I need to make it just over a word.

IE: over the word Long Island as it fades in. ( Image Attached )

PS. This is my first Question about AS. I dont know if i worded it correctly. Please let me know if you need more info.

There are 2 files FLA and  a PS
 He is what i have
/* AS for the FLV file */
for (var i:uint =0; i < 20; i++) {
	var circle:Particle = new Particle ();
	circle.x = Math.random()*200;
	circle.y = Math.random()*100;
	circle.alpha = Math.random();
	circle.scaleX = circle.scaleY = Math.random();
/* AS for the AS file */
	import flash.display.MovieClip;
	import flash.events.Event;
	public class Particle extends MovieClip
		function Particle() 
			this.addEventListener(Event.ENTER_FRAME, update);
		function update(e:Event):void
			this.scaleX = this.scaleY -= .02;
			this.alpha -= .01;

Open in new window

1 Solution
You must determine the area where you would like the particles to appear. e.g. If the x co-ordinate of the word Long begins at 50 pixels and the ending letter of  'Island' is at 200 pixels

Then the random number for x in you loop should be between 50 and 200.

Same with the y co-ordinate.

circle.x = (Math.random()*150) + 50; //between 50 and 200
circle.y = (Math.random()*50) + 100; //between 100 and 150

MLSLIAuthor Commented:
Thanks! That did it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now