Thursday 9 February 2012

Dynamically Loading Assets in AS3

Recently I have had the requirement to to load assets from a given location inside one of our flex application. It took my a good few hours to work how and or the best way to go around this is so in the hope that this will save someone, somewhere sometime here is the code. Basically it loads a given image resource, showing or hiding the image depending on the outcome of the load.

Asset Loader:


This simple snippet may hopefully save you some time.