Hello, I was trying to create a easy way of creating a rectangular but when I tried my code it gave me the error:
G:/Haxe/haxe/lib/openfl/3,5,3/openfl/utils/ByteArray.hx:7: characters 7-23 : Typ e not found : lime.utils.Bytes
Main.hx:
` package;
import openfl.display.Sprite;
import openfl.events.MouseEvent;
import openfl.display.SimpleButton;
import openfl.display.DisplayObject;
class Main extends Sprite {
private var button:Button;
private var st:Rect2D;
private var hv:Rect2D;
private var cl:Rect2D;
public function new () {
super ();
init();
}
public function init() {
fillBackGround(0xff00ff, 640, 960);
st = new Rect2D(20, 30, 0xffffff);
// hv = new Rect2D(20, 30, 0xff00ff);
// cl = new Rect2D(20, 30, 0xff0000);
// addChild(st);
// addChild(hv);
// addChild(cl);
// button = new Button(hv, cl, st, 20, 20);
// button.button.addEventListener(MouseEvent.CLICK, click);
// addChild(button);
}
public function fillBackGround(color:Int, w:Int, h:Int) {
this.graphics.beginFill(color);
this.graphics.drawRect(0, 0, w, h);
this.graphics.endFill();
}
public function click(e:MouseEvent) {
trace("test");
}
}`
Recangular.hx
`package;
import openfl.display.Sprite;
class Rect2D extends Sprite {
public var ww:Int;
public var hh:Int;
public var cc:Int;
public function new(w:Int, h:Int, col:Int) {
super();
this.width = w;
this.height = h;
this.cc = col;
this.graphics.beginFill(this.cc);
this.graphics.drawRect(20, 50, this.ww, this.hh);
this.graphics.endFill();
}
}`
Button.hx:
`package;
import openfl.display.Sprite;
import openfl.display.SimpleButton;
class Button extends Sprite {
public var button:SimpleButton;
public var hover:Sprite;
public var click:Sprite;
public var stat:Sprite;
public var xp:Int;
public var yp:Int;
public function new(h:Sprite, c:Sprite, s:Sprite, xx:Int, yy:Int) {
super();
this.hover = h;
this.click = c;
this.stat = s;
this.xp = xx;
this.yp = yy;
button = new SimpleButton(this.stat, this.hover, this.click, this.stat);
}
public function tick() {
hover.x = this.xp;
hover.y = this.yp;
click.x = this.xp;
click.y = this.yp;
stat.x = this.xp;
stat.y = this.yp;
}
}`