0
我可以修改和編譯AS3的SDK使用的strictgecho.c示例沒問題。Flash Alchemy內置的.swc函數庫太小且缺少函數
對於自己的應用程序,我編譯使用g ++幾十個成功的文件和鏈接:
g++ -swc -o myApp.swc glue.o demo.o obj1.o obj2.o obj3.o
我得到一個myApp.swc,但它是錯誤的只有80K(大小一樣簡單stringecho例子) 。
當任何Flash IDE檢查,不同於具有
cmodule.stringecho.AlchemyBlock
cmodule.stringecho.AlchemyBreakPoint
...
這myApp.swc的stringecho.swc具有
cmodule.AlchemyBlock
cmodule.AlchemyBreakPoint
...
而且具有我定義的無膠的功能。實質上,我不能在AS3項目中使用它。
我的glue.c代碼如下。基本上,我創建一個演示對象並調用它的函數。演示類封裝了所有其他對象文件。
#include "demo.h"
#include "AS3.h"
AS3_Val InitSystem(void* self, AS3_Val args)
{
demo = new demo9();
return 0;
}
AS3_Val LoadSceneFile(void* self, AS3_Val args)
{
demo->loadScene("scene.txt");
return 0;
}
...
int main()
{
AS3_Val InitSystemMethod = AS3_Function(NULL, InitSystem);
AS3_Val LoadSceneFileMethod = AS3_Function(NULL, LoadSceneFile);
AS3_Val getAlchemyScreenMethod = AS3_Function(NULL, getAlchemyScreen);
AS3_Val setMouseStateMethod = AS3_Function(NULL, setMouseState);
AS3_Val rasterizeMethod = AS3_Function(NULL, rasterize);
AS3_Val result = AS3_Object("InitSystem: AS3ValType,LoadSceneFile: AS3ValType,getAlchemyScreen:AS3ValType,setMouseState:AS3ValType,rasterize:AS3ValType"
,InitSystemMethod,
LoadSceneFileMethod,
getAlchemyScreenMethod,
setMouseStateMethod,
rasterizeMethod);
AS3_Release(InitSystemMethod);
AS3_Release(LoadSceneFileMethod);
AS3_Release(getAlchemyScreenMethod);
AS3_Release(setMouseStateMethod);
AS3_Release(rasterizeMethod);
AS3_LibInit(result);
return 0;
}
對您有幫助嗎?如果是這樣,請接受我的回答作爲答案 – paleozogt 2011-05-20 15:04:47