Here is an example capx of what you want.
click/tap anywhere to spawn a firefly object use arrow right and left to move the firefly objects. If they touch the box and if explosion (global variable) is 1 then there will be an explosion and they will fly away