4 frame animation

I have 4 frames of an animation of stars that appear on screen in a random area. It works, accept it only shows my 4th frame

 function spawnStars()  
 local sunbeam = movieclip.newAnim{ "images/stars1.png", "images/stars2.png", "images/stars3.png", "images/stars4.png" }  
 sunbeam.x = math.random(350, 430)  
 sunbeam.y = math.random(80, 160)  
 sunbeam:scale(3, 1.5)   
 if audioset == 1 then  
 audio.play( fireworkSound )  
 end   
 transition.to( sunbeam:play{startFrame=1, endFrame=4,loop=1, remove=true}, { time=1000, x=sunbeam.x + math.random(-50, 50 ),alpha=1.0 } )   
 end  
 timer.performWithDelay ( 400, spawnStars, 8 )  

now if I change this line to the following, all the frames work, but it doesn’t end.

  
  
transition.to( sunbeam:play{}, { time=1000, x=sunbeam.x + math.random(-50, 50 ),alpha=1.0 } )   

Any ideas on what I’m doing wrong?

Dan [import]uid: 78446 topic_id: 19441 reply_id: 319441[/import]

I don’t think that Corona supports transition that way. And logically, you are calling a function when you use sunbeam:play(), which doesn’t return an object that is needed for transition.

You need to separate your sequence and just have sunbeam inside the transition.to(). If you play your sunbeam the line before or after you won’t be able to notice a difference in the starting times between the play and the transition, and it will only play 1 loop. [import]uid: 54716 topic_id: 19441 reply_id: 75133[/import]