Tutorial Openfl for Facebook Instant Games

Is there anyone provide tutorial Openfl for Facebook Instant Games?

First question about replace openfl preloader with facebook preloader

At this moment after we call at index.html

lime.embed (ā€œbattleships_piratesā€, ā€œopenfl-contentā€, 0, 0, { parameters: {} });

Openfl preloader will start and it will call Main Class after all assets loaded.

Can we start openfl only to track size of loading assets from project.xml and call Main Class manually?
At this moment FBIG initialize like this :

 FBInstant.initializeAsync().then(function() {        
    FBInstant.setLoadingProgress("progress");
    FBInstant.startGameAsync().then(function() {
           startGame(); or call MainClass.hx
    });				
 });

Is it possible to customize so fit with requirement FBIG?

Try the following:

openfl create CustomPreloader
cd CustomPreloader
openfl test neko

Thatā€™s an example of a custom preloader, which gives you the ability to decide when the project advances to the document class, as well as displaying a custom preloader. Iā€™m sure thereā€™s a way to probably link this with the Facebook API, could you use this as a starting point to experiment?

@singmajesty, Yes I already use customPreloader.

Can I replace the Openfl preloader with FBIG default preloader? Like the example on Phaser : https://phaser.io/tutorials/getting-started-facebook-instant-games/part4

Yes, I believe you would make a custom preloader, which would not have itā€™s own progress bar, but on progress events, would instead update the Facebook preload value

Hi,
I am working on it too. Do you have the same issue as me : My game exceeds the viewport, like 4 times ā€¦ (look like 200% width and 200% height).
Anyway did you succeed to use custom preloader ? I thought their preloader is on top of your game and only disappeard when you call ā€˜FBInstant.startGameAsync()ā€™
Edit : Just thinking that you can just call the method and then use custom preloader ā€¦

Hello @Petithomme,

Sorry for a long reply, yes recently I successfull manage preloader FBIG with Openfl.
Hereā€™s my example :

  1. Modify index.html with 3 step

  2. Use my custom preloaderFBIG
    https://github.com/stein-D/openfl-fbig-preloader/blob/master/PreloaderFBIG

Thanks.

1 Like