Frage

I'm trying out Haxe programming and OpenFL library with Flashdevelop as the IDE. I made a package for my global game classes and then tried to import it, it just says the class I'm importing doesn't exist. Shouldn't it notice that I have the class in a source file under the Source directory?

Here is the Source/Main.hx file:

package;

import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.Font;

import openfl.Assets;

import globals.Room;

class Main extends Sprite {

    public function new () {

        super ();

    } 
}

And here is the Source/Globals.hx file:

package globals;

public class Room {

    public function new() {

    }

}
War es hilfreich?

Lösung

Classes in the package this.is.a.package should be in the folder [source]/this/is/a/package so you should probably make a Room.hx file in Source/globals/

Also, FlashDevelop can make the class in the right folder if you define the package when you create it with the "Add -> New Class" menu (right click on your project)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top