Flint Particle System Forum - MouseAntiGravity on PixelRenderer? Sun, 11 Dec 2011 10:44:04 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1598#Comment_1598 http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1598#Comment_1598 Thu, 14 Apr 2011 22:56:56 +0100 jbitautas

var glassImage:BitmapData = new GlassImage ( 100, 250 );
var tween2Emitter:Emitter2D = new Emitter2D();
var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, 400, 200 ) );
addChild( renderer );
setChildIndex (renderer, 0);

tween2Emitter.addInitializer( new Lifetime( 6 ) );
tween2Emitter.addAction( new Age( Quadratic.easeInOut ) );
tween2Emitter.addAction( new TweenToZone( new BitmapDataZone( glassImage, 40, 60 ) ) );
tween2Emitter.addAction( new RandomDrift( 20, 20 ) );
tween2Emitter.addAction( new MouseAntiGravity(10,renderer) );

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( tween2Emitter );

startEmitter.start();
tween2Emitter.start();


Thanks ]]>
MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1599#Comment_1599 http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1599#Comment_1599 Fri, 15 Apr 2011 16:26:58 +0100 jbitautas
hit.addEventListener (MouseEvent.ROLL_OVER, antiGrav);

private function antiGrav (event:MouseEvent):void {

startEmitter.removeAction (new TweenToZone (new BitmapDataZone (glass)));
tween1Emitter.removeAction (new TweenToZone (new BitmapDataZone (copy1)));
tween2Emitter.removeAction (new TweenToZone (new BitmapDataZone (glass)));
antiGravity = new MouseAntiGravity (10, renderer);
startEmitter.addAction (antiGravity);
trace ("HIT");
}

Thanks ]]>
MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1600#Comment_1600 http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1600#Comment_1600 Fri, 15 Apr 2011 19:57:56 +0100 jbitautas MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1601#Comment_1601 http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1601#Comment_1601 Fri, 15 Apr 2011 20:03:55 +0100 jbitautas MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1608#Comment_1608 http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1608#Comment_1608 Wed, 20 Apr 2011 08:18:32 +0100 Richard
You can't combine physics based actions like MouseAntiGravity, with literal actions like TweenToZone because the literal action ignores the physics and sets the particle position where it thinks it should be regardless. You could try some other method to move the particles towards their destination or create a custom renderer along the lines of the TweenToZone but using physics (maybe use the destination in the zone as a gravity well for that particle rather than a literal tween destination).

For the mouse events, the renderer has its mouseEnabled and mouseChildren set to false by default. If you set the mouseEnabled to true you won't need to wrap the renderer in a movie clip.

You can only get mouse events on specific particles if you use the DisplayObjectRenderer (and set mouseChildren to true), because this is the only renderer in which the particles are rendered as discrete display objects - the BitmapRenderer and PixelRenderer render all the particles in a single Bitmap object.

Hope that helps. Sorry you had to wait a while for a reply. ]]>