GithubHelp home page GithubHelp logo

johanvdb / openfl-preloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yupswing/openfl-preloader

0.0 2.0 0.0 338 KB

Preloader example for HAXE3/OpenFL

License: MIT License

Haxe 100.00%

openfl-preloader's Introduction

OpenFL-Preloader

Preloader example for HAXE3/OpenFL

The background

In HAXE/OpenFL you can add a Preloader to your App/Game very easily.
You just need to add this parameter in your project.xml, in the APP tag.
<app main="Main" path="Export" file="Preloader" preloader="Preloader" />
the preloader argument ask for a Class (in this case is Preloader.hx, so it becomes Preloader)

The preloader class HAS to extend NMEPreloader to work.
Also remember you cannot use the assets loader inside the class (use the macro instead)

You should notice the preload will be compiled and used only for Flash and HTML5 targets, in any(?) other target it will be ignored completely

The class has already prepared two objects:
outline:Sprite is the border of the loading bar
progress:Sprite is the loading bar
Inside the onUpdate function (which I overidded in this example) the progress bar will be scaled (only x) to show the loading percentage.
You can see the original class here https://github.com/openfl/openfl-native/blob/master/templates/haxe/NMEPreloader.hx

My preloader

This project offers a class (Preloader.hx) and a real use. You can use the class in your project like Main.hx does here.

Here's how the preloader looks like. (with automatic fluid scaling on resize)

You can customize the colors very easily, and if you code (and I know you code) you can change the class and make it fit your needs.

Demo

You can test an online version here.
https://dl.dropboxusercontent.com/u/683344/akifox/preloader/Preloader.swf
If your connection is very fast I doubt you will see the preloader (the file is just 300kb)

You can use Sloppy (http://www.dallaway.com/sloppy/) to slow down the connection (it's a proxy that delay the data flow). I used that to test my design, you can use it here: just make it pointing to my demo, set to 128k/s, and dive the web like in 1999!

openfl-preloader's People

Contributors

yupswing avatar johanvdb avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.