-
-
Notifications
You must be signed in to change notification settings - Fork 417
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
Assets.getBitmapData not working? #12
Comments
Targeting flash an error occurs: I tried to add an "assets" tag in the xml but still no luck. |
Sorry. < assets path="Assets" rename="assets" exclude="nme.svg" /> as in the old NME example (I was missing the "rename"). It may be worth mentioning, in the "Transition-to-OpenFL" page, that you need an "assets" tag? |
When someone embedded an asset using NME, they would use an tag and they would use nme.Assets Now with embedded @:bitmap tag (and others) you can directly embed assets, avoiding the openfl.Assets class and accompanying tag ... its up to your preference :) |
@jgranick Will openfl.Assets class stay in openfl or it will be removed after some time? |
Joshua, thank you very much for your patience. This leads me to my next question: http://www.nme.io/index.php?cID=11557 |
Hi there, So I was having a problem where Assets.getBitmapData ("assets/nme.png"); is returning null. Turns out that I need to import and use "nme.Assets" instead of "openfl.Assets". After I did that, getBitmapData started working. Shouldn't openfl be independent from NME? Thanks, guys! |
I found this thread when trying to figure this out, and thought I would post what I did incase it could help anyone. in my project.xml: then in your Main.hx: then
|
I fell in the same trap. Perhaps the error message could be more noob friendly by stating "... Please check your project.xml" |
Update README.md
In https://github.com/openfl/openfl/wiki/Transition-to-OpenFL
says "you can use the "openfl.Assets" like you would in NME".
However, if you change "DisplayingABitmap" sample as:
-Adding "import openfl.Assets"
-Replacing
"var bitmap = new Bitmap (new Image (0, 0));"
for
var bitmap = new Bitmap (Assets.getBitmapData ("assets/nme.png"));
(or
"var bitmap = new Bitmap (Assets.getBitmapData ("nme.png"));"
)
the bitmap is not displayed, and no error or warning is shown.
The text was updated successfully, but these errors were encountered: