PC snow fx knocking out the next page function

I used the plug in Kwiksher to create a storybook app. I was able to add snow to one of my pages, but now when I turn the page all of the animations and functionality is gone.
I ran the terminal and got this message:

Runtime error
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1177: attempt to perform arithmetic on local ‘emitterRot’ (a nil value)

I am using the pre made snow from the special fx provided with the product.

Couple of things… I tried adding this
Particles.CleanUp()
at the end of the page, and made the particles not work at all… (although functionality was restored on subsequent pages.

Thanks!
Laura [import]uid: 106593 topic_id: 22640 reply_id: 322640[/import]

Here is more of the error message I discovered:
leftToRight
Runtime error
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1302: attempt to perform arithmetic on field ‘x’ (a nil value)
stack traceback:
[C]: ?
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1302: in function ‘Update’
…er/Documents/Kwik/The Snow Queen 3/build/page_11.lua:80: in function <…er snow queen>
?: in function <?:215>
Runtime error
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1177: attempt to perform arithmetic on local ‘emitterRot’ (a nil value)
stack traceback:
[C]: ?
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1177: in function ‘Update’
…er/Documents/Kwik/The Snow Queen 3/build/page_11.lua:80: in function <…er snow queen>
?: in function <?:215>
Runtime error
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1177: attempt to perform arithmetic on local ‘emitterRot’ (a nil value)
stack traceback:
[C]: ?
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1177: in function ‘Update’
…er/Documents/Kwik/The Snow Queen 3/build/page_11.lua:80: in function <…er snow queen>
?: in function <?:215>
Runtime error
…s/Kwik/The Snow Queen 3/build/lib_particle_candy.lua:1177: attempt to perform arithmetic on local ‘emitterRot’ (a nil value)
stack traceback:

then it repeats over and over… sorry if this is TMI.
Laura [import]uid: 106593 topic_id: 22640 reply_id: 90299[/import] </…er></…er></…er>

I’d guess that turning the page is removing an emitter while the particle code is continuing to run. The code is probably trying to place a particle using an emitter with no defined rotation, hence the math with a nil value error.

You probably should remove particles on page turn events and restart them when the new page is loaded. [import]uid: 1560 topic_id: 22640 reply_id: 90663[/import]

Thanks Dotnaught…

I have been trying to clean up the particles and emitters with all of the clean codes but each time it makes the simulator go black…
here is the pre made snow fx code starting at the good bit…
Particles.AttachParticleType(“E1”, “Snow” , 15, 99999,0)

Particles.StartEmitter(“E1”)


– MAIN LOOP

local function main( event )

– UPDATE PARTICLES
Particles.Update()

end

– timer.performWithDelay( 33, main, 0 )
Runtime:addEventListener( “enterFrame”, main )


I don’t see where PC is cleaning up, so I have tried cleaning up myself with the following…

StopEmitter(“E1”) (makes everything black except for a tiny sliver on the right)
Particles.CleanUp() (makes everything black period)
ClearParticles(emitterName) (makes everything black except you can still see the particles…)

Do you know another way to remove particles on page turn event? I basically just pasted the PC provided code into my project and removed the particle count, sfx, and their own background. Everything else is as they gave it to me.
Thanks! [import]uid: 106593 topic_id: 22640 reply_id: 90674[/import]

Are you removing your runtime listener before trying to clean up Particle Candy? [import]uid: 93133 topic_id: 22640 reply_id: 90685[/import]

Nick,
What command would I use to stop the runtime listener?
Thanks [import]uid: 106593 topic_id: 22640 reply_id: 90796[/import]

I just tried this:


local function main( event )

– UPDATE PARTICLES

Particles.Update()
end

– timer.performWithDelay( 33, main, 0 )
Runtime:addEventListener( “enterFrame”, main )
Runtime:removeEventListener(“enterFrame”, main)
Particle:CleanUp()


this has knocked out the particles completely, but once again the functionality on the next page is restored. I feel like I need something between the addEventListner and the removeEventListner…

[import]uid: 106593 topic_id: 22640 reply_id: 90802[/import]

You only want to call

[lua]Runtime:removeEventListener(“enterFrame”, main)
Particle:CleanUp()[/lua]

when your scene is ending and you are ready to turn to the next page.
[import]uid: 93133 topic_id: 22640 reply_id: 90935[/import]