You need to do a bit more work I'm afraid. The reason for the flicker is that when you press your desired key, program is running so fast that key press is detected in multiple passes of loop.
When you press key, store in a variable fact you have pressed key and don't allow another press of key until you have let go of key.
Try following:
sync on : sync rate 0
circle 64,64,60
get image 1,0,0,128,128
sprite 1,100,100,1
a=0
do
if inkey$()=" "
if a=0
if sprite visible(1)
hide sprite 1
else
show sprite 1
endif
a=1
endif
else
a=0
endif
text 0,0,"Press SPACE to toggle sprite"
sync
loop
The programmer formerly known as sonic