Just for future reference, you can post your code with code tags like this:
[ c o d e ]
code goes here
[ / c o d e ]
You don't need
show object 1 because you never hid the object in the first place.
Take out the
CLS command and it should look fine. Honestly, I'm not sure why that's affecting it at all, it shouldn't be.
sync rate 60
sync on
load image "Earth.bmp", 1,0
make object sphere 1, 200, 40, 40
texture object 1, 1
set ambient light 100
starquantity = 400
starlayers = 5
speedfactor# = -0.75
type starfield
X AS FLOAT
Y AS FLOAT
Z AS INTEGER
speed AS FLOAT
color AS DWORD
endtype
dim stars(starquantity) as starfield
for s=0 to starquantity
stars(s).x = rnd(800)
stars(s).y = rnd(600)
stars(s).z = int(s/(starquantity/starlayers))+1
stars(s).speed = stars(s).z * speedfactor#
temp_col = (255/starlayers) * stars(s).z
stars(s).color = rgb(temp_col, temp_col, temp_col)
next s
repeat
`cls
position object 1,40,40,0
yrotate object 1, object angle y(1)+1
for s=0 to starquantity
sx# = stars(s).x : sy# = stars(s).y
dot sx#, stars(s).y, stars(s).color
sy# = sy# - stars(s).speed
if sy# > 600 then sy# = 0
stars(s).y = sy#
next s
sync
until spacekey()=1
end