Animated Splash Screen - do I run a risk of race condition

I wanted to do an animated splash screen by mingling draw instructions in with the game’s initialization code - something like this.

init block 1  
animation frame 1  
init block 2  
animation frame 2  
init block 3  
animation frame 3  

However, I’ve noticed that the devices don’t finish the animation frames before moving onto the next initialization blocks, so I had to switch it to something like the following. However, I’m wondering if I run any risk of some of the code in block 2 running before block 1 finishes - anyone have any experience with this? I haven’t seen it happen but once it’s on lots of different devices I’m not sure what to expect.

[code]
enterFrameListener=function(event)
stateCounter=stateCounter+1
if(stateCounter==1) then
–first bunch of initialization code
else if (stateCounter == 15) then
–show first animation bit
else if(stateCounter==30) then
–second bunch of initialization code
else if (stateCounter == 45) then
–show second animation bit

–and so on
end

Runtime:addEventListener( “enterFrame”, enterFrameListener )
[/code] [import]uid: 32462 topic_id: 18656 reply_id: 318656[/import]

That will run very fast and could miss execution.

You need to be a little more robust in your checks

ie :

  
if stateCounter \> 1 and stateCounter \< 15 then  
  
elseif stateCounter \>= 15 and stateCounter \< 30  
  

[import]uid: 84637 topic_id: 18656 reply_id: 71734[/import]