StageXL is a Dart library intended for Flash developers who want to migrate their projects as well as their skills to HTML5. The lib provides the familiar Flash API built on top of the Dart programming language, which is very similar to ActionScript 3.

It uses the same class hierarchy as Flash does, so it’s possible to extend  UI-objects from DisplayObject (Container) or just work with the Sprite class, for instance. It has classes such as Bitmap, which are DisplayObjects that can be scalable, rotatable, movable and blendable with the familiar properties like x, y, rotation, scaleX, scaleY and alpha.

The lib also has some great addition, such as the modern Dart event system, a built-in resource manager and an abstraction of  the Web Audio API.


// Events
mySprite.addEventListener(Event.ENTER_FRAME, enterFrameListener);
mySprite.addEventListener(MouseEvent.CLICK, mouseClickListener, useCapture:true);
var subscription1 = mySprite.onEnterFrame.listen(enterFrameListener);
var subscription2 = mySprite.onMouseClick.listen(mouseClickListener);
var subscription3 = mySprite.on("customEvent").listen(customEventListener);

subscription1.cancel();    // equals removeEventListener(...)
subscription2.pause();     // pause receiving events
subscription2.resume();    // resume receiving events

// Text
var textField = new TextField();
textField.defaultTextFormat = new TextFormat('Spicy Rice', 30, Color.Black);
textField.text = 'The quick brown fox jumps over the lazy dog.'
textField.x = 20;
textField.y = 20;
textField.width = 100;
textField.height = 50;
textField.wordWrap = true;

// Sound
// The ResourceManager substitutes embedded resources of Flash.
var resourceManager = new ResourceManager();
resourceManager.addSound("plop", "sounds/plop.mp3");   // loads ogg-file in Firefox!
var sound = resourceManager.getSound("plop");
var soundTransform = new SoundTransform(0.5);
var soundChannel =, soundTransform);

// Filters
var spaceShip = new SpaceShip();
spaceShip.x = 100;
spaceShip.y = 50;
spaceShip.filters = [
    new ColorMatrixFilter.grayscale(),
    new GlowFilter(Color.Yellow, 1.0, 20, 20)];
spaceShip.applyCache(0, 0, 200, 80);

// Juggler
var tween = new Tween(sprite, 2.0, TransitionFunction.easeOutBounce);;;
tween.delay = 1.0;
tween.onComplete = () => sprite.removeFromParent();

// Resource manager
var resourceManager = new ResourceManager()
  ..addBitmapData('dog', 'images/dog.png')
  ..addSound('plop', 'sounds/plop.mp3')
  ..addTextureAtlas('fl', 'images/flowers.json', TextureAtlasFormat.JSONARRAY);

resourceManager.load().then((result) {
  var dog = resourceManager.getBitmapData('dog');
  var plop = resourceManager.getSound('plop');
  var flowers = resourceManager.getTextureAtlas('fl');
  var daisy = flowers.getBitmapData('daisy');
Misc . URL.