Hi List, I want to load some bitmap images, so i have created a class with embed meta data in it, and i wrote a function to get them out and use them. But it does not seem to work.
Can you use the 'new' keyword for an element in an Array? Code below: public class CarAssets { [Embed(source="img/pro_car.png")] private static const PRO_CAR : Class; public static const ALL_CARS:Array = [PRO_CAR]; public static function getAsset( index:uint ):Bitmap { return Bitmap( new ALL_CARS[index]() as Class ); } } } I need some help (the code rather than me) because when i do: var carImage:Bitmap = CarAssets.getAsset( _index ); it fails. Or does anybody know a better method? Cheers, Sidney -- Sidney de Koning - "If you're not prepared to be wrong, you'll never come up with something original" Flash / AIR Developer @ www.funky-monkey.nl Actionscript 3 Teacher @ www.sae.nl Technical Writer @ www.insideria.com Blogger @ www.funky-monkey.nl/blog/ 3GB free storage you can sync with your mobile device or Mac or PC. Check out https://www.getdropbox.com/referrals/NTI1MjcxMzk _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders