James James
James James

Reputation: 23

Wait for class method to complete in ActionScript 3

I'm currently creating a website with AS3 in FlashDevelop, so it's code only — no timeline stuff.

I have a class that loads images with a method that I call from my main source. I was wondering how I go about making sure that the images are loaded before executing more code outside of the class. I know how to do it using Event.COMPLETE in the image class, but I am unsure how to get the main class to wait.

How do I do this?

Thanks in advance!

Upvotes: 2

Views: 464

Answers (1)

Amarghosh
Amarghosh

Reputation: 59451

Dispatch a custom event (like imgLoaded) from the image loading class once all images are loaded. Listen for that event in the main class and call the remaining functions from this event listener.

Upvotes: 1

Related Questions