Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
How do I?: How do I make the particles start when mouse is down and stop when mouse is up?
Bottom of Page1 to 4 of 4
-
- CommentAuthorJordan589
- CommentTimeApr 29th 2011
This is what I did to make the particles start when the mouse goes down:
import org.flintparticles.common.actions.Age;
import org.flintparticles.common.actions.Fade;
import org.flintparticles.common.counters.Steady;
import org.flintparticles.common.displayObjects.Line;
import org.flintparticles.common.easing.Quadratic;
import org.flintparticles.common.initializers.ColorInit;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.common.initializers.SharedImage;
import org.flintparticles.twoD.actions.Accelerate;
import org.flintparticles.twoD.actions.LinearDrag;
import org.flintparticles.twoD.actions.Move;
import org.flintparticles.twoD.activities.RotateEmitter;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.Velocity;
import org.flintparticles.twoD.renderers.BitmapRenderer;
import org.flintparticles.twoD.zones.DiscSectorZone;
var emitter:Emitter2D = new Emitter2D();
emitter.counter = new Steady( 200 );
emitter.addActivity( new RotateEmitter( -7 ) );
emitter.addInitializer( new SharedImage( new Line( 3 ) ) );
emitter.addInitializer( new ColorInit( 0xFFFFFF00, 0xFFFF6600 ) );
emitter.addInitializer( new Velocity( new DiscSectorZone( new Point( 0, 0 ), 250, 170, 0, 0.2 ) ) );
emitter.addInitializer( new Lifetime( 1.3 ) );
emitter.addAction( new Age( Quadratic.easeIn ) );
emitter.addAction( new Move() );
emitter.addAction( new Fade() );
emitter.addAction( new Accelerate( 0, 50 ) );
emitter.addAction( new LinearDrag( 0.5 ) );
var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 500, 500 ) );
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.97,0 ] ) );
renderer.addEmitter( emitter );
addChild( renderer );
emitter.x = 260;
emitter.y = 350;
btn.addEventListener(MouseEvent.MOUSE_DOWN, emitter.start);
When I run the code I get this error:
1046: Type was not found or was not a compile-time constant: btn.
I don't see what I did wrong and I also don't know how to stop the emitter. -
- CommentAuthorRichard
- CommentTimeMay 3rd 2011
It looks like btn isn't defined in your code. -
- CommentAuthorJordan589
- CommentTimeMay 4th 2011
What do you mean? -
- CommentAuthorRichard
- CommentTimeMay 9th 2011
The error message indicates that btn (in the last line of your code) doesn't exist.
1 to 4 of 4
