Registering custom events

Hi,

I would really appreciate if someone can point me in the right direction.

My objective here is to execute some code after previous 10 images are completely loaded. Those 10 images, I am loading them one by one sequentially with the following code -

i = 0
function time:timer(e)
i = i + 1
timeNum = display.newImage(ball[i], 230, 290)
timeNum.alpha = 0
transition.to(timeNum , {alpha=1.0, time= 800})
end

timer.performWithDelay(4000 , time, 10)

local text = display.newText(“All images loaded”)

I want this text to be displayed only after all the 10 images are loaded. Right now, with the above code the text is displayed right after the first image is displayed.

I am not sure how to go about this. Can someone help?

Thanks, [import]uid: 36520 topic_id: 10054 reply_id: 310054[/import]

@4nand,
Did you have a look at this post
http://howto.oz-apps.com/2011/05/create-notification-center-like-in.html

I have created a class that one can add to their projects for registering custom events.

In your case above, if you are setting the launch time to be 4000 for each image, why do you not run that code after 4000*11 which will be more or less after all of the images are loaded for sure.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 10054 reply_id: 36726[/import]

Thanks. I will take a look at the link. But my actual code is much more complicated than that. I have lots of image loading that needs to be sequential like this. I have a set of images that I load using timer the above way, and once done I start right at that instant loading of another set of images sequentially. It is hard for me to coordinate all of them just by timer [import]uid: 36520 topic_id: 10054 reply_id: 36733[/import]