You need to provide a little bit of information.
For how long should the object be on screen? What are is the condition under which it will be destroyed? Timer, enemy collision or on button press?
Is the spawning point of the objects set to be anywhere on the whole screen?
Basically you need to set up a variable that checks if the object is on screen.
I usually go with numeric variable and set 0=not true 1= true, as in binary code on/off.
Object_spawned_on_screen = 0
IF Object_spawned_on_screen = 0
Create object at position (x=random(0,yourscenewidth),y=random(0,yoursceneheight)) ----> example: if scene is 640x480 enter accordingly
Wait 4 seconds
Now there can be a problem where your object spawns half cut at the edge of the screen. In this situation we need to add a margin to the spawning area above, basically depending on the margin and the size of the sprite we can either add a pixel amount, half of the object sprite, or the whole width and height of the object.
So for example:
This will give you a 100 pixel buffer around the scene, where the object will not spawn.