我正在尝试在这里找到的 hello world 示例:http: //help.adobe.com/en_US/Flex/4.0/CompilerAPI/flex_4.0_compilerapi.pdf
但是,我不断收到以下错误:
message =“无法解析为组件实现。路径:/home/xxx/public_html/DSM10.mxml 行:1”
如果我尝试在这里找到的 hello world 示例,它可以正常工作:http: //livedocs.adobe.com/flex/3/compilerAPI_flex3.pdf
我正在使用 apache-tomcat-6.0.35 在 LAMP 堆栈上运行 hello world 示例。
这是我的代码:
String dirPublicHtml = dirPathApp + "/../../public_html";
String dirOutput = dirPublicHtml + "/outgoing";
File parent = new File(dirPublicHtml).getCanonicalFile();
VirtualLocalFileSystem fs = new VirtualLocalFileSystem();
File dsmFile = new File(parent, "DSM10.mxml");
Flex 4 Compiler API 文档中的“Hello World”
VirtualLocalFile lf = fs.create(dsmFile.getCanonicalPath(),
"<?xml version='1.0'?>
<s:Application xmlns:fx='http://ns.adobe.com/mxml/2009'
xmlns:s='library://ns.adobe.com/flex/spark'
xmlns:mx='library://ns.adobe.com/flex/mx'>
<s:Label text='Hello World'/> </s:Application>", parent,
System.currentTimeMillis());
Flex 3 编译器 API 中的“Hello World”
/*VirtualLocalFile lf = fs.create(dsmFile.getCanonicalPath(),
"<?xml version='1.0'?>
<mx:Application xmlns:mx='http://www.adobe.com/2006/mxml'>
<mx:Label text='Hello World'/></mx:Application>", parent,
System.currentTimeMillis());*/
Application app = new Application(lf);
app.setLogger(logger);
app.setOutput(new File(dirOutput + "/DSM10.swf"));
long result = app.build(true);
lf.close();
if (result <= 0) throw new Exception(logger.getLogMessage());