|
Viewing 1 to (6 Total) Bitmaps drawing in NME Preloader |
Total Posts: 40
Joined: September 01, 2011
|
Hello,
Recently I have started to understand with the preloader in NME. I created class like NMEPreloader (from install-tool/flash/haxe/NMEPreloader) - having copied all methods and having renamed to Preloader. I have added to nmml file "". And have got first error: "export/flash/haxe/ApplicationMain.hx:20: characters 3-31 : Preloader should be NMEPreloader". To resolve it we can change line 7 in install-tool/flash/haxe/ApplicationMain.hx to "static var mPreloader: : RELOADER_NAME::;" and everything will work well (exactly how default NMEPreloader is working). So first question: is it bug? or we must create derived class from NMEPreloader?
Second thing I have tried to implement is bitmap loading in my Preloader. I simply have written line in onInit() function (the image on the specified way exists):
public function onInit()
{
var _bitmap = Assets.getBitmapData("assets/images/768/gui/loading.png");
}
And have got this error message from flash player:
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/ctor()
at flash.display::BitmapData()
at NME_assets_images_768_gui_loading_png()
at nme.installer::Assets$/getBitmapData()
at Preloader/onInit()
at ApplicationMain$/main()
at boot_f91c/init()
at flash::Boot/start()
at boot_f91c()
And I don't know how to fix it? Or maybe I'm doing something wrong? Help me, please How to load image from assets in Preloader to show it to player?
And another small question: How about preloader class in CPP target, where we can load game images?
Thanks 
Tags:
Posted on November 04, 2011 at 5:25 AM
|
|
|
Total Posts: 2146
Joined: August 25, 2011
|
Re: Bitmaps drawing in NME Preloader
Does this work if called from your application, after preloading?
var _bitmap = Assets.getBitmapData("assets/images/768/gui/loading.png");
If it does, but fails during the preloader, then I might try using the new @bitmap tag to embed the image into the preloader directly, as a workaround for the time being. This use-case needs to be tested more ... I have some ideas, but it will probably require that the default preloader is written differently (as an example)
Posted on November 04, 2011 at 9:37 AM
|
Total Posts: 40
Joined: September 01, 2011
|
Re: Bitmaps drawing in NME Preloader
Yes of course, Joshua, it works after preloading. I don't know about embedded images in Flash (I'm completely new to Flash platform ) Can you write an example of this preloader in haxe or give me a link to it, please?
Posted on November 04, 2011 at 10:15 AM
|
Total Posts: 2146
Joined: August 25, 2011
|
Re: Bitmaps drawing in NME Preloader
Take a look at this for a little information on the @bitmap tag:
http://ncannasse.fr/blog/haxe_2.08...
I would suggest using that for now, until we're able to work with the preloader some more
Posted on November 04, 2011 at 10:29 AM
|
Total Posts: 40
Joined: September 01, 2011
|
Re: Bitmaps drawing in NME Preloader
Oh, thank you, Joshua! It seems to be working now in Flash!
Posted on November 04, 2011 at 11:21 AM
|
Total Posts: 548
Joined: October 07, 2011
|
Re: Bitmaps drawing in NME Preloader
Hi,
The idea was for your class to "extend" the NMEPreloader, then you could assign it to the mPreloader without error.
I guess there is no real reason for this requirement, but I thought it may save some effort.
We could add a property "preloader" to assets to allow them in the pre-loader. I think to code change would be something like:
for(asset in assets)
if (asset.preloader && toSwf (asset, new_tags)) inserted = true;
new_tags.push (TShowFrame);
for(asset in assets)
if (!asset.preloader && toSwf (asset, new_tags)) inserted = true;
Hugh
Posted on November 06, 2011 at 11:17 PM
|