[haXe] [Q] copying from a loader object to Bitmap

Danny Wilson danny at decube.net
Sun Jul 1 18:10:38 CEST 2007


> I have this scenario that won't compile with HaXe.
>
> var image:Bitmap = Bitmap(_loader.content);
Are you trying to cast to bitmap? Or create a new Bitmap?

Casting in haXe works like:
var image:Bitmap = cast _loader.content; // cast 'knows' you specified  
Bitmap as type

Or else you might want to do:
var image:Bitmap = new Bitmap(_loader.content);

or simply:
var image = new Bitmap(_loader.content);


:-)



More information about the Haxe mailing list