Particles not drawn since engine update (1.1.161 to 1.1.163)

9 views
Skip to first unread message

Lukas Taves

unread,
Dec 1, 2010, 2:09:43 PM12/1/10
to Stardust Particle Engine
I made no changes in the set up code. Just by changing the engine swc
makes the particles disappear. If i switch back to the older one they
show up as always...

Any thoughts?

CJ Cat (Allen Chou)

unread,
Dec 3, 2010, 6:24:51 AM12/3/10
to Stardust Particle Engine
Can you post your code that uses Stardust?
That would greatly help me in finding out the cause of your problem.

Thanks.

Lukas Taves

unread,
Dec 3, 2010, 12:05:01 PM12/3/10
to Stardust Particle Engine
Hi! I already find out :P The step function from the emitter changed
its signature. Now it receives an number instead of an event, which
means i can't directly assign it as a event handler. (What i don't get
is why the hell flash even allowed the code to compile which would've
saved quite some time)

But i have another question: Does the emitter have any event that is
called every frame by himself? I'm using distinct emitters, as i need
them to travel at random points of the screen, and before that i could
just assign the step function to a sprite's enter frame event... now i
have nothing to attach it to. Any directions on the matter?

CJ Cat (Allen Chou)

unread,
Dec 3, 2010, 12:14:07 PM12/3/10
to Stardust Particle Engine
Actually, you may still attach the emitter's step method to your
sprite.

You may extend the sprite class and define a method that serves as a
listener to the enterFrame event, in which the emitter's step() method
is called. This should do the trick.

Just so you know. I've removed every piece of code depending of the
Flash event system, and switched to my own version of Robert Penner's
AS3Signals library, CJSignals (http://code.google.com/p/cjsignals/).
You may check out the wiki pages on the CJSignals homepage to get a
grasp of it.

Lukas Taves

unread,
Dec 3, 2010, 12:28:29 PM12/3/10
to Stardust Particle Engine
This is the code i'm trying to use now:

var step:Function = function(e_:Event)
{
emitter.step();
}
sprite.addEventListener(Event.ENTER_FRAME, step);

i tried this so i can mantain a reference for each emitter i create,
but that doesn't work properly as when the function is finally called
emitter does not represent the reference i would like it to.

Prior 1.2 i could just do this:

sprite.addEventListener(Event.ENTER_FRAME, emitter.step);

And it worked like a charm :P

Lukas Taves

unread,
Dec 3, 2010, 12:37:00 PM12/3/10
to Stardust Particle Engine
Howa, that was quick :P

Thank you for the answer, great idea :P

I would like to get rid of flash event system myself, but its actually
kinda too late for the project XD

But thank you!

CJ Cat (Allen Chou)

unread,
Dec 3, 2010, 12:41:10 PM12/3/10
to Stardust Particle Engine
Hmm...I don't see any problem in your code, only that you're using an
anonymous function. Personally, I'd avoid using anonymous functions,
for they have notorious reference issues.

Try using a private method as a listener.

Something like this

class MySprite extends Sprite {

private var emitter:Emitter;

function MySprite() {
emitter = new MyEmitter();
}

private function enterFrameListener(e:Event):void {
emitter.step();

Lukas Taves

unread,
Dec 3, 2010, 1:09:21 PM12/3/10
to Stardust Particle Engine
I've done something like that after reading you posting thank you :P

I posted the other code before i realized you already posted XD

Thank you! It really did the trick ^^
Reply all
Reply to author
Forward
0 new messages