I'm working with FlashBuilder 4.6 and using AS3Eval v0.3 library from: http://eval.hurlant.com/
The library is fully working in one of my Flex 4.6.0 projects but not in the other (same library linkage "Merge into code" of EvalES4.swc library).
In the first project following code works:
private var compiler:CompiledESC = new CompiledESC;
public function compile(code: String) : ByteArray {
return compiler.eval(code);
}
In the other project, it fails with: ReferenceError: Error #1065: Variable compile is not defined.
The error is referring to following line in the AS3Eval library (that EvalES4.swc file)
var compile:Function = getDefinitionByName("ESC::compile") as Function;
Looks like the library has problem to fully load Tamarin ESC in the other project.
I've checked that both projects (they are using the same library... but still checked) load the Tamarin ESC successfully via
// inside CompiledESC.as
private function loadESC():void {
var a:Array = [
new debug_abc as ByteArray,
new util_abc as ByteArray,
new bytes_tamarin_abc as ByteArray,
new util_tamarin_abc as ByteArray,
new lex_char_abc as ByteArray,
new lex_scan_abc as ByteArray,
new lex_token_abc as ByteArray,
new ast_abc as ByteArray,
new parse_abc as ByteArray,
new asm_abc as ByteArray,
new abc_abc as ByteArray,
new emit_abc as ByteArray,
new cogen_abc as ByteArray,
new cogen_stmt_abc as ByteArray,
new cogen_expr_abc as ByteArray,
new esc_core_abc as ByteArray,
new eval_support_abc as ByteArray,
new esc_env_abc as ByteArray,
]
ByteLoader.loadBytes(a, true);
}
These ByteArray classes are embedded inside the SWC using [Embed] (looking through the library code) and all ByteArrays are in both cases initialized and loaded via ByteLoader.
So far, I have not found any clue why compiling is working for my first project but not for the other. Does anybody has similar experiences or some hints what may cause the problem?
Best, Jakub