Flint Particle System Forum - Features2011-12-11T10:31:49+00:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Featureshttp://flintparticles.org/forum/comments.php?DiscussionID=446&Focus=1509#Comment_15092011-01-14T14:53:26+00:002011-12-11T10:31:49+00:00FlashDev2007http://flintparticles.org/forum/account.php?u=460
Apologies for not trawling the forum for answers, I thought this would be an easy one for people familiar with Flint to answer. I would really like to use Flint for an animation that I need to ...
1. Can I create particles from any display object I create, eg. some bubbles that open up with text in when I click them? 2. Is it possible to make certain particles get attracted to one I click on? 3. Can you change the movement behaviour at runtime?
Many thanks,
Neil]]>
Featureshttp://flintparticles.org/forum/comments.php?DiscussionID=446&Focus=1510#Comment_15102011-01-16T18:17:22+00:002011-12-11T10:31:49+00:00FlashDev2007http://flintparticles.org/forum/account.php?u=460
Ok, so I had some time today and I went through the forum posts and I have answers to my first two questions, i'll get to number 3 when I get the chance. I seem to be getting two click events ...
Any ideas?
[SWF (backgroundColor="#000000")] public class FlintTest extends Sprite { protected static const PARTICLE_COUNT:int = 25; protected var emitter:Emitter2D;
public function FlintTest() { emitter = new Emitter2D(); var renderer:DisplayObjectRenderer = new DisplayObjectRenderer(); renderer.mouseChildren = true; renderer.mouseEnabled = true; renderer.addEventListener(MouseEvent.CLICK, clickHandler); renderer.addEmitter(emitter); addChild(renderer);
emitter.counter = new Blast(PARTICLE_COUNT); emitter.addInitializer(new Position(new RectangleZone(0,0,stage.stageWidth, stage.stageHeight))); emitter.addInitializer(new ImageClass(MyParticle));
var zone:DiscZone = new DiscZone(new Point(0, -50), 100, 10); emitter.addInitializer(new Velocity(zone)); emitter.addInitializer(new CollisionRadiusInit(20)); emitter.addInitializer(new MassInit(Math.random()*0.1)); emitter.addInitializer( new RotateVelocity(-Math.PI / 2, Math.PI / 2));
protected function clickHandler(event:MouseEvent):void { trace("clicked: " + event.target.name) } } } ]]>
Featureshttp://flintparticles.org/forum/comments.php?DiscussionID=446&Focus=1515#Comment_15152011-01-18T03:25:01+00:002011-12-11T10:31:49+00:00Richardhttp://flintparticles.org/forum/account.php?u=1
Your listening for clicks on both the particles and the renderer. That's why you receive two click events. You need only listen on one of these.
You can modify behaviour at runtime by either
1. ...
You can modify behaviour at runtime by either
1. adding and removing actions from/to the emitter to change the behaviour. 2. using an action that alters its behaviour dynamically (writing your own actions is not hard - look in the source code of a few of the included actions for clues).
Richard]]>
Featureshttp://flintparticles.org/forum/comments.php?DiscussionID=446&Focus=1517#Comment_15172011-01-18T14:32:04+00:002011-01-18T14:32:16+00:00FlashDev2007http://flintparticles.org/forum/account.php?u=460
Thanks for the reply Richard, I created a custom action to check if there is a listener attached or not, and adds one if needed. The current example I'm working on now uses a SineCounter so I would ...
Neil]]>
Featureshttp://flintparticles.org/forum/comments.php?DiscussionID=446&Focus=1518#Comment_15182011-01-18T14:43:01+00:002011-12-11T10:31:49+00:00FlashDev2007http://flintparticles.org/forum/account.php?u=460
Apologies for not reading the docs more thoroughly, I found ParticleEvent.PARTICLE_DEAD.
Cheers
Cheers]]>