Search code examples
actionscript-3flashhaxehaxeflixel

What is the equivalent of the Adobe Flash symbol library for Haxe?


I'm trying to cross over to HaxeFlixel after learning of Flash's demise, but I'm not entirely sure how to bridge my understanding between the two. I'm currently using Visual Studio Code on a Mac.

In Flash(now Animate CC), you have a library full of symbols:

enter image description here

You can right-click and edit those symbols, such as setting a base class:

enter image description here

I have all of the .as base classes in my project folder and each one controls the Symbol(s). When I'm in VSC, I can create .hx files and I have a folder dedicated to images with all my game bitmaps in it. From there, I do not know how to recreate my game. What is a library of symbols, that I can assign base classes to, when coding in Haxe?


Solution

  • There's no library as you know it from Flash in OpenFL. If you look for "native" OpenFL asset handling look at the openfl.Assets class. It provides functions to load and parse several asset file formats.

    If you need a class for your HaxeFlixel project that allows you to extend the basic functionality of a sprite you can extend FlxSprite and load the graphic/sprite sheet inside the constructor:

    class Block extends FlxSprite{
      public function new(){
        super();
        loadGraphic("assets/images/block.png", false, 64, 64);
      }
    }
    

    You don't want to extend but just load the bitmap/spritesheet into a FlxSprite? Not much of a difference:

    var block = new FlxSprite();
    block.loadGraphic("assets/images/block.png");
    add(block);
    

    See also: