GithubHelp home page GithubHelp logo

bhanditz / starling-preloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshtynjala/starling-preloader

0.0 2.0 0.0 154 KB

An example preloader for Starling Framework running in Adobe Flash Player in a web browser

ActionScript 100.00%

starling-preloader's Introduction

Preloader for Starling

SWFs running in a web browser should have preloaders. A preloader allows you to quickly display graphics and animation so that visitors to your webpage have something to look at while the rest of the SWF file loads.

How do you create a preloader for a Starling app? It's not really any different than creating a preloader for any other SWF. Here's a summary of how I do it. Be sure to look at the included source code for complete details.

  1. Extend flash.display.MovieClip when creating the startup class. Call stop() in the constructor.

  2. Use the following command line argument to compile your Starling root class on frame 2 instead of frame 1. It's the class that you will pass to the Starling constructor. It usually extends starling.display.Sprite.

    -frame two,com.example.StarlingRoot
    
  3. Wait for the SWF to be completely loaded. Listen for Event.COMPLETE on the loaderInfo object.

  4. In the Event.COMPLETE listener, call gotoAndStop(2) to switch to frame 2.

  5. Get a reference to the Starling root class by calling getDefinitionByName(). Do not import this class. If you import it, it will be compiled on frame 1 instead of frame 2, and then the preloader won't work.

    var RootType:Class = getDefinitionByName("com.example.StarlingRoot") as Class;
  6. Call getDefinitionByName() again to get a reference to starling.core.Starling. Again, do not import this class.

  7. Initialize Starling using the classes returned by getDefinitionByName().

Please see the comments in the example code for more detailed explanations.

This project is not designed to create a preloader with Flash Professional. It is meant as an example for Flash Builder or any other development environment that uses the command line compiler.

starling-preloader's People

Contributors

joshtynjala avatar

Watchers

James Cloos avatar  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.