ActionScript
public class A
{
public var callbackPtr:Function = callback();
public function A()
{
var loader:CLibInit = new CLibInit;
var alchemyClass = loader.init();
alchemyClass.setA(this);
alchemyClass.callAS()
}
public function callback():Function
{
function callbackTrace(bytes:ByteArray):void
{
trace("callback...");
}
return callbackTrace;
}
}
C
AS3_Val classA;
AS3_Val setA(void *self, AS3_Val args)
{
classA = AS3_Undefined();
AS3_ArrayValue(args, "AS3ValType", & classA);
return AS3_Null();
}
AS3_Val callAS(void *self, AS3_Val args)
{
AS3_CallS("callbackPtr", classA, AS3_Null());
return AS3_Null();
}