Flint Particle System Forum - about MouseEvent Tue, 13 Dec 2011 03:13:16 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1339#Comment_1339 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1339#Comment_1339 Mon, 13 Sep 2010 15:38:11 +0100 RobC I have this problem: I want to add a MouseEvent in this simple code just to trigger the particles movement:


[SWF(width="500", height="500", frameRate="60", backgroundColor="#000000")]

var emitter:Emitter2D = new Emitter2D();
var render:BitmapRenderer = new BitmapRenderer(new Rectangle(0, 0, 500, 500), true);

emitter.counter = new Blast(50);

emitter.addInitializer(new SharedImage(new RadialDot(4)));
emitter.addInitializer(new ColorInit(0xFF00FF00, 0x0000FFFF));
emitter.addInitializer(new Position(new RectangleZone(0, 0, 500, 500)));

emitter.addEventListener(MouseEvent.CLICK, movement);

function movement(e:MouseEvent) {
emitter.addInitializer(new Velocity(new RectangleZone(20, 0, 0, 20)));
emitter.addAction(new Move());
}

render.addEmitter(emitter);
addChild(render);

emitter.start();

I know that this addEventListener does nothing but I would know what is the right way.
Thank! ]]>
about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1350#Comment_1350 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1350#Comment_1350 Tue, 14 Sep 2010 21:14:06 +0100 Ubuntu
stage.addEventListener(MouseEvent.CLICK, movement); ]]>
about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1354#Comment_1354 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1354#Comment_1354 Thu, 16 Sep 2010 08:49:15 +0100 Richard
The particles can be made clickable -

render.mouseEnabled = true;
render.mouseChildren = true;
render.addEventListener(MouseEvent.CLICK, movement);
]]>
about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1356#Comment_1356 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1356#Comment_1356 Thu, 16 Sep 2010 09:41:19 +0100 RobC
render.mouseEnabled = true;
render.mouseChildren = true;

render.addEventListener(MouseEvent.CLICK, movement);

function movement(e:MouseEvent) {
emitter.addInitializer(new Velocity(new RectangleZone(20, 0, 0, 20)));
emitter.addAction(new Move());
}


I don't understand why.... ]]>
about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1357#Comment_1357 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1357#Comment_1357 Thu, 16 Sep 2010 10:10:43 +0100 RobC emitter.start() inside the function but, in this way, before the click there arent any particles on the stage.
What I want, if possible, is to start the movement of the particles when they are just on the stage.... ]]>
about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1359#Comment_1359 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1359#Comment_1359 Thu, 16 Sep 2010 11:56:07 +0100 Richard about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1362#Comment_1362 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1362#Comment_1362 Thu, 16 Sep 2010 16:19:54 +0100 RobC about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1363#Comment_1363 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1363#Comment_1363 Fri, 17 Sep 2010 07:13:47 +0100 Richard about MouseEvent http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1364#Comment_1364 http://flintparticles.org/forum/comments.php?DiscussionID=396&Focus=1364#Comment_1364 Fri, 17 Sep 2010 12:17:42 +0100 RobC Now is all ok, very good explanation! ]]>