So, i create a new project MyComponent.hx
package com.sakura;
import nme.display.Sprite;
import nme.events.Event;
class MyComponent extends Sprite {
var colour:Int;
var speed:Float;
public function new() {
super();
colour = 0xff0000;
speed = 1.0;
addEventListener(Event.ENTER_FRAME, onUpdate);
redraw();
}
function onUpdate(_)
{
x = x + speed;
if (x>stage.stageWidth-100)
x = 0;
}
function redraw()
{
var gfx = graphics;
gfx.clear();
gfx.beginFill(colour);
gfx.drawCircle(0,0,100);
getTamere();
}
public function setProperty(inName:String, inValue:String)
{
switch(inName)
{
case "y", "scaleX", "scaleY", "speed":
Reflect.setProperty(this, name, Std.parseFloat(inValue));
case "colour", "color":
if (inValue.substr(0,2)!="0x")
inValue = "0x" + inValue;
colour = Std.parseInt(inValue);
redraw();
}
}
public function getTamere():Int{
return 42;
}
public static function main():Void{
trace('lalala');
}
}
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta
title="NME View"
package="com.sakura"
version="1.0.0"
company="nme"
/>
<app
file="MyComponent"
main="com.sakura.MyComponent"
/>
<source path="src" />
<haxelib name="nme" />
</project>
nme build build.nmml androidview
--
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.
-- -- François Nicaise https://www.linkedin.com/in/fnicaise Freelance Game Developer / Designer Business Relations @ FrenchCows Gaming & Business @ Bordeaux Games
public int getTamere(){
return (Integer)haxeCallbackObject.call0("getTamere") ;
}
com.nmehost.MyComponent c =new MyComponent();
String tamere = Integer.toString(c.getTamere());
Log.d( tamere,"value" );
haxeCallbackObject is null in getTamere()
my component does not seem to be properly instantiated, maybe because it's also an Activity.
Anyway, In accordance with what I can read here https://github.com/haxenme/nme/tree/master/templates/android-view-test i add MyComponent as a Fragment
<fragment
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:name="com.nmehost.MyComponent"
android:id="@+id/fragment"
android:layout_marginTop="73dp"
android:layout_below="@+id/button"
android:layout_alignLeft="@+id/button"
android:layout_alignRight="@+id/button"
/>
And... when i test it on my phone ...
java.lang.UnsatisfiedLinkError: Couldn't load ApplicationMain from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.dmouton.myapplication-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.dmouton.myapplication-1, /vendor/lib, /system/lib]]]: findLibrary returned null
Aaaarrrrrggg it's make me crazy :/