silexlabs/Cocktail — Issue #99: image loader, cast issue
Author: lexoyo
Created: 2011-12-28 17:08:34+00:00
State: open

when compiling with NME, I have found a really strange issue in image loading, which should not even work in AS3:

The application (pong) does compile well, but at runtime the application closes unexpectedly. The problems is in cocktailCore.resource.as3.ResourceLoader.hx, at line 71 :

//start the loading
loader.load(request);

The "loader" is defined as

var loader:Loader = cast(_nativeElement); // <- here _nativeElement is a Sprite !!! not a Loader

And here, when you trace its value (at least in NME compiled app), it is a Sprite, not a Loader. Maybe that it works in AS because Loader and Sprite are both DisplayObjectContainer, but it should not work....