简体   繁体   中英

adding a fla file from ported flash project to haxe (openfl)

What I want is to convert a flash project to an openfl project (which is written in haxe) in order to use its cross platform feature. I used as3hx to convert actionscript classes of a flash project to haxe. Then I fix compile errors by hand, and fix a run time error too. When I compile the project, I see a blank black window, which means that graphics are not loaded. I convert the code and code is working fine, but I don't know what should I do with graphics. There is a fla file in flash project, which I don't know how to convert it to openfl.

Adobe Flash CC, which is the program used to write flash project, does the linkage of a symbol to a actionscript class, and I don't know how to do this in openfl.

In openfl, as far as I know, giving graphics to a class is done like this :

import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.Sprite;
import openfl.Assets;

class Main extends Sprite {

    public function new () {

        super ();
        var bd:BitmapData = Assets.getBitmapData("img/openfl.png");
        var b:Bitmap = new Bitmap(bd);
        addChild(b);    

    }

}

Where the openfl.png is a graphical file in a special folder named img, which declared to be an assets path.


I use HaxeDevelop IDE.

Thanks for any help

You can't use FLA files inside OpenFL, there's only support for SWF files exported by Flash from those FLA files:

http://www.openfl.org/learn/tutorials/using-swf-assets/

OpenFL's "native" SWF playback functionality is limited but for simple graphics and animations it's usable as long as you figure out what features are actually being supported and limit yourself to those.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM