Flint Particle System Forum - Clear Stage Sun, 11 Dec 2011 12:56:54 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Clear Stage http://flintparticles.org/forum/comments.php?DiscussionID=487&Focus=1643#Comment_1643 http://flintparticles.org/forum/comments.php?DiscussionID=487&Focus=1643#Comment_1643 Thu, 19 May 2011 20:46:25 +0100 LanceMango i have a growing gras animation. 3 buttons: start the animation, pause the animation and one for cleanig up the stage.
Start and Pause are working without problems, but i'm desperating with the cleaning button. i tried many many ways, nothing worked.
please, can anyone help?
here ist the code:

<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:f="http://flintparticles.org/2009/flint2d"
width="500" height="500"
backgroundColor="#000000">

<fx:Script>
<![CDATA[
import mx.core.mx_internal;

import org.flintparticles.common.events.EmitterEvent;
import org.flintparticles.common.events.ParticleEvent;
import org.flintparticles.common.particles.Particle;
import org.flintparticles.twoD.particles.Particle2D;
import org.flintparticles.twoD.particles.Particle2DUtils;
import org.flintparticles.twoD.particles.ParticleCreator2D;

protected function start(event:MouseEvent):void
{
emitter.start();

}

protected function pause(event:MouseEvent):void
{
emitter.pause();
}

protected function reset(event:MouseEvent):void
{
// emitter.killAllParticles();
// emitter.removeParticles( emitter.particles ) ;

}

]]>
</fx:Script>
<s:Rect width="500" height="500" x="0" y="0">
<s:fill>
<s:BitmapFill source="@Embed('bilder/bg.png')"/>

</s:fill>
</s:Rect>

<f:BitmapLineRenderer width="500" height="500">
<f:emitters>
<f:Emitter id="emitter" autoStart="false" x="250" y="400" runAheadTime="0" >
<f:counter>
<f:Blast startCount="100"/>
</f:counter>
<f:initializers >
<f:Position>
<f:DiscZone centerX="0" centerY="0" outerRadius="100"/>
</f:Position>
<f:Velocity>
<f:DiscSectorZone centerX="0" centerY="0" outerRadius="80" innerRadius="40" minAngle="{-5 * Math.PI / 8}" maxAngle="{-3 * Math.PI / 8}"/>
</f:Velocity>
<f:ColorInit minColor="0xFF718f3a" maxColor="0xFF8dac35"/>
<f:Lifetime lifetime="7"/>
</f:initializers>
<f:actions>

<f:Move/>
<f:Age/>
<f:Accelerate x="0" y="10"/>
<f:ScaleImage startScale="1" endScale="1"/>

</f:actions>
</f:Emitter>
</f:emitters>
</f:BitmapLineRenderer>

<s:Group x="100" y="470">

<s:Button x="0" label="start" click="start(event)"/>
<s:Button x="120" label="stop!" click="pause(event)"/>
<s:Button x="220" id="cut" label="clean stage" click="reset(event)"/>

</s:Group>

</s:Application> ]]>
Clear Stage http://flintparticles.org/forum/comments.php?DiscussionID=487&Focus=1645#Comment_1645 http://flintparticles.org/forum/comments.php?DiscussionID=487&Focus=1645#Comment_1645 Mon, 23 May 2011 22:18:16 +0100 Richard
protected function reset(event:MouseEvent):void
{
emitter.killAllParticles();
renderer.bitmapData.fillRect( emitter.bitmapData.rect, 0 );
}

...

<f:BitmapLineRenderer id="renderer" width="500" height="500">
]]>