giabao / tinyui

A tiny UI macro for injecting ui items declared in a xml file into a haxe class. Inspired by stablexui. Use with OpenFL
http://sandinh.com
MIT License
16 stars 4 forks source link

initUI unknown identifier #1

Open francescoagati opened 9 years ago

francescoagati commented 9 years ago

trying to use tinyui with openfl i get this error

Source/Main.hx:16: characters 2-8 : Unknown identifier : initUI

this is the example code

package;

import openfl.display.Sprite;
import openfl.text.Font;
import openfl.text.TextField;
import openfl.text.TextFormat;
import openfl.Assets;

//import cocktail.api.CocktailView;

@:tinyui('ui/prova.xml')
class UI05ViewItem extends Sprite {
    public function new() {
        super();
        initUI();
    }
}
class Main extends Sprite {
        public function new() {
                super();

        }
}

and the xml file ui/prova.xml

<UI>
<!--You declare UI in a xml file, then `inject` into a haxe class by macro meta:
`@:build(TinyUI.build(path_to_xml_file))`
The injected class is call the `building class` -->
<!--`code` in xml can interact with code in .hx and vise versa
TinyUI is just a macro tool to translate xml into haxe code!-->
<!--See the generated code. TinyUI will generate a initUI function in the building class-->
</UI>

i' am using tinkui 6.0.1

and this the project.xml

<?xml version="1.0" encoding="utf-8"?>
<project>

    <meta title="Adding Text" package="org.openfl.samples.addingtext" version="1.0.0" company="OpenFL" />
    <app main="Main" path="Export" file="AddingText" />

    <source path="Source" />
    <haxelib name="openfl" />
    <!--<haxelib name="cocktail" />-->
    <haxelib name="tinyui" />
    <assets path="Assets" rename="assets"  />

</project>

I think that the problem is that build macro isn't processed

francescoagati commented 9 years ago

I have try to compile the project in example folder and i get this error

Called from /usr/lib/haxe/std/neko/_std/EReg.hx line 33
Called from <builtin> line 1
Called from /usr/lib/haxe/std/neko/_std/EReg.hx line 22
Called from /usr/lib/haxe/lib/tinyui/6,0,1/main/src/TinyUI.hx line 645
Called from /usr/lib/haxe/lib/tinyui/6,0,1/main/src/TinyUI.hx line 95
Called from /usr/lib/haxe/lib/tinyui/6,0,1/main/src/TinyUI.hx line 66
ERROR! tinyui build failed: Unsupported escaped char 's'

may be a problem with haxe 3.2?