lime
lime copied to clipboard
Assets.isLocal give different result if you specify the AssetType or not
Assets.loadLibrary ("delayed").onComplete (function (library) {
trace(Assets.isLocal("delayed:assets/stars.mp3", cast "SOUND")); //true
trace(Assets.isLocal("delayed:assets/stars.mp3"));//false (should be true, right?)
sound = Assets.getSound ("delayed:assets/stars.mp3");
trace(Assets.isLocal("delayed:assets/stars.mp3", cast "SOUND"));//true
trace(Assets.isLocal("delayed:assets/stars.mp3"));//true
}
Glancing at the source code, it's obvious enough why this happens.
return switch (requestedType)
{
case IMAGE:
cachedImages.exists(id);
case MUSIC, SOUND:
cachedAudioBuffers.exists(id);
case FONT:
cachedFonts.exists(id);
default: cachedBytes.exists(id) || cachedText.exists(id);
}
Probably meant to be an optimization, but maps are pretty fast, so I doubt it matters much.