|
| Really have no clue of what's going on. It seems that when you extend a CustomNode and add to it some extra public functions is only possible to access them through script level code:
//Field.fx public abstract class Field extends CustomNode { public var label: String; }
//FieldTypeA.fx public class FieldTypeA extends Field { public var value: Integer = 0; override protected function create(): Node { Text { content: bind value.toString() font: Font.font("Sans Serif", 20) textOrigin: TextOrigin.TOP } } public function increment(): Integer { value++; } }
//MainThatWorks.fx //Ok: It Works var field = FieldTypeA {}; field.increment(); field.increment();
Stage { title : "Test CustomNode public funtion" scene: Scene { width: 200 height: 200 content: [field] } }
//MainThatDoesntWork.fx Stage { var field = FieldTypeA {}; field.increment(); field.increment(); title : "Test CustomNode public funtion" scene: Scene { width: 200 height: 200 content: [field] } }
Whats wrong? |