Tutorial Openfl for Facebook Instant Games


#1

Is there anyone provide tutorial Openfl for Facebook Instant Games?


#2

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?


#3

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?


#4

@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


#5

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


#6

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 …


#7

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.