-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlxG.as line 738,743 undefined property bitmapData #15
Comments
Comment by: IQAndreas The "Graphic" you pass in should be a Class that extends Bitmap (NOT ByteArray or BitmapData). What does your code look like? |
There should be a more descriptive error message if the user passes in an invalid class. It might also be better to have the function return the default graphic rather than throwing an exception. I'm thinking something like: if(!checkBitmapCache(Key))
{
var bitmap:Bitmap = new Graphic() as Bitmap;
if(bitmap == null)
{
FlxG.log("Error: " + Graphic + " must extend flash.display.Bitmap.");
return FlxG.addBitmap(FlxSprite.ImgDefault);
}
_cache[key] = bitmap.bitmapData;
} |
Good idea!
Of course, with the old code, you could pass in any class as long as it has a Though, in such a case, it may be better adding another method named |
I liked the warning message @moly suggested. About the the |
@Dovyski I noticed you were assigned to this issue. Do you already have the code ready for this fix, or shall I write some up and add the pull request? I think we should separate off adding the error message in this release, and adding the |
I am sorry, I assigned this issue to me but stopped working when I noticed there would be some conflicts during the merge. I did nothing so far, @IQAndreas , so feel free to implement what was discussed. Bare in mind there are some pending pull requests that affect that very area of the code. I agree with you about the error message and the new method. Leave |
It seems that all pull requests that modify |
I made two additional tweaks in the pull requst:
|
The About the "reverse", I can't tell if that makes any difference. In the context of the fix, the default image is just a "placeholder", so it's not that important to reverse it or not. |
Resolved by 58f1e1f |
Resolves the following issue: * FlxG.as line 738,743 undefined property bitmapData - FlixelCommunity#15 - AdamAtomic#217
Issue #217 by: kreso22
My editor caught it (Access of undefined property bitmapData)
The text was updated successfully, but these errors were encountered: