Class not found : openfl.display.Bitmap

29 views
Skip to first unread message

Gerson Montenegro

unread,
Jun 29, 2015, 6:21:21 PM6/29/15
to haxe...@googlegroups.com
Hi.

I'm a AS3 programmer, but I'm new in Haxe on Ubuntu 15.04. Recently I try differents ways to compile an SWF from a simple piece of code like this:

package;

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

class Main extends Sprite{


public function new () {

super ();

var bitmap = new Bitmap (Assets.getBitmapData ("Assets/openfl.png"));
addChild (bitmap);

bitmap.x = (stage.stageWidth - bitmap.width) / 2;
bitmap.y = (stage.stageHeight - bitmap.height) / 2;

}
}

I tried to write code in some editors, but until now, the best option is SublimeText...anyway, the problem it's that I still cannot compile a SWF file.

I'm fine if I can do it at least from console using haxe command, but that's doesn't work. I'm using

haxe -main Main -swf test.swf

...but I get the error:

Main.hx:4: characters 7-28 : Class not found : openfl.display.Bitmap

I have installed OpenFL, and thats right because when I write 'openfl' in console, that show:

 .d88 88b.                             888888b 888 
d88P" "Y88b                            888     888 
888     888                            888     888 
888     888 88888b.   .d88b.  88888b.  8888888 888 
888     888 888 "88b d8P  Y8b 888 "88b 888     888 
888     888 888  888 88888888 888  888 888     888 
Y88b. .d88P 888 d88P Y8b.     888  888 888     888 
 "Y88 88P"  88888P"   "Y8888  888  888 888     "Y888P 
            888                                   
            888                                   
OpenFL Command-Line Tools (3.1.0-LOMZel)
Use openfl setup to configure platforms or openfl help for more commands
Use -Dv2 or -Dlegacy with your commands to use OpenFL 2.x legacy mode

I don't know what else to do. Any idea?

thanks

Fernando Serboncini

unread,
Jun 29, 2015, 6:46:03 PM6/29/15
to haxe...@googlegroups.com
You can't just compile with haxe without linking to OpenFL (if you expect the Flash libraries).
Take a look at:

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

aleksejs-...@altplus.co.jp

unread,
Jun 29, 2015, 9:17:29 PM6/29/15
to haxe...@googlegroups.com
To compile that you need a command: lime test flash

Instead of `test` you can use:

clean -- Remove the target build directory if it exists
update -- Copy assets for the specified project/target
build -- Compile and package for the specified project/target
run -- Install and run for the specified project/target
test -- Update, build and run in one command
rebuild -- Recompile native binaries for libraries

Just type `lime help` to get a full list of commands.

One last tip: currently lime will build everything with Next version, it's newer but some features are still missing. Currently, I personally recommend to use this command: lime test flash -Dlegacy
The -Dlegacy flag will build with an older version of lime but it's more stable.

Alex.
Reply all
Reply to author
Forward
0 new messages