[haXe] [Q] copying from a loader object to Bitmap
Michael Norton
mnorton at wecare.net
Sun Jul 1 18:26:04 CEST 2007
hi,
I previously tried,
> var image:Bitmap = new Bitmap(_loader.content);
and the compiler returned:
src/BHCTextures.hx:20: characters 13-40 : Invalid arguments
src/BHCTextures.hx:20: characters 13-40 : Function 'new' requires
arguments : ?bitmapData, ?pixelSnapping, ?smoothing
However, I tried thecast _loader.content and that worked!
thanks.
Mike
On Jul 1, 2007, at 9:10 AM, Danny Wilson wrote:
>> 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);
>
>
> :-)
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070701/073d8248/attachment.htm
More information about the Haxe
mailing list