OpenFL Samples that scale when on mobile and desktop?

Hey! I’m trying to see how to build an app that scales well between mobile and desktop.

I have yet to see a single sample from the OpenFL samples that actually shows how to achieve this with non-vector assets.

I tried compiling all of the “Open Samples” ( for Flash and Neko, but none of them scaled in any way when resized.

The key feature of OpenFL that people are hoping to see is cross platform support. Write once, Run anywhere. And the samples should have a clear example of how to do this, but I haven’t been able to find it.

Can someone point me to a sample that shows how to do this for non vector assets?



PS: For example, I’ve been trying to use StablexUI on an itouch 5. It compiles and runs on it fine, but is scaled too small. The lib itself doesn’t support DPI based scaling, but a StablexUI widget could be added as a child to a Sprite that did scale correctly. Any input on any of the above would be greatly appreciated…

Probably the best way at the moment is to listen for Event.RESIZE, then scale everything based on stage.stageWidth and stage.stageHeight.

I guess you could try setting stage.scaleMode, but that really isn’t as good as doing it yourself.

You could also try the layout library (sample usage here), but it doesn’t seem to include any way to ensure your objects don’t overlap. I wrote my own version, but I haven’t gotten around to documenting it, and I’m planning to make some major changes anyway.

1 Like

hey! thanks for the info… I’ll try that… I’m just surprised that its’ not part of the default samples for OpenFL is all… I’ll take a look at both your and Joshua’s libraries…

The PiratePig sample should resize for different screens, and uses bitmap graphics. It isn’t 100% elegant, but it’s a simple solution.

The SimpleSWFLayout sample helps illustrate how you might consider using something like Flash to create a 2D layout, but use the “layout” library to help stretch that at runtime.