//--------------------------------------------test.cpp
// g++ test.cpp -O3 -Wall -swc -o test.swc
#include <iostream>
#include <list>
#include <vector>
#include "AS3.h"
using namespace std;
//vector<float> vf;
list<float> vf;
static AS3_Val getSize(void* self, AS3_Val args)
{
int num = vf.size();
return AS3_Int(num);
}
int main()
{
AS3_Val getSizeMethod = AS3_Function( NULL, getSize);
AS3_Val result = AS3_Object( "getSize:AS3ValType", getSizeMethod);
AS3_Release( getSizeMethod );
AS3_LibInit( result );
return 0;
}
//-------------------------------------------------test.as
// C:\alchemy\flex4\bin\mxmlc -library-path+=./test.swc -static-link-runtime-shared-libraries=true test.as
package{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import cmodule.test.CLibInit
public class test extends Sprite{
public function test() {
var info:TextField = new TextField();
this.addChild(info);
var loader:CLibInit = new CLibInit();
var lib:Object = loader.init();
info.appendText("size:" + lib.getSize() + "\n");
}
}
}
- - - - - - - - - - - - - - - - - - -问题 - - - - - - ------
1.test.swf 无法运行,但是如果我使用vector,就可以了!
2.如果我将一些元素推回列表中,它可以运行,但是我得到的大小是错误的!
谁能帮我!谢谢!!!