2011-05-13 16 views
0

我尝试编译文件到命令行中使用mxmlc的SWF。当它是一个非常简单的mxml时,编译成功。但是当文件包含fx名称空间时,出现如下编译错误:无法解析(或)到组件实现。无法解析<FX:声明>(或<fx:Script>)的组件实现

我必须要能够做到这一点,没有Flash Builder中的帮助,因为我上一个项目,我需要生成从中我们生成的代码MXML文件的SWF文件的工作。

有什么建议吗?

我试图编译的代码是:

<?xml version="1.0" encoding="utf-8"?> 
<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" 
minWidth="800" minHeight="600" width="800" height="600" 
currentState="s1" 
backgroundColor.s1="16777215" backgroundColor.s2="16777215" backgroundColor.s3="16777215" 
creationComplete="application1_creationCompleteHandler(event)"> 
<fx:Script> 
<![CDATA[ 
import mx.events.FlexEvent; 
protected function btnNext_clickHandler(event:MouseEvent):void{currentState= states[++stateIndex].name;} 
protected function btnPrev_clickHandler(event:MouseEvent):void{currentState= states[--stateIndex].name;} 
protected function application1_creationCompleteHandler(event:FlexEvent):void{stateIndex=0;} 
    ]]> 
</fx:Script> 
<s:states> 
<s:State name="s1"/> 
<s:State name="s2"/> 
<s:State name="s3"/> 
</s:states> 
<fx:Declarations> 
<fx:int id="stateIndex"/> 
</fx:Declarations> 
<s:controlBarContent> 
<s:Label text="e-cognitio" id="lblEcognitio" fontSize="10" color="#3C3C3C" fontWeight="bold" fontStyle="italic" paddingTop="4"/> 
<s:Button label="&lt;" height="14" width="27" id="btnPrev" enabled="true" fontSize="10" fontWeight="bold" cornerRadius="5" click="btnPrev_clickHandler(event)" enabled.s1="false"/> 
<s:Button label="&gt;" id="btnNext" enabled="true" fontSize="10" fontWeight="bold" width="27" height="14" cornerRadius="5" click="btnNext_clickHandler(event)" enabled.s3="false"/> 
<s:Label text="blah" id="lblLessonName" fontFamily="Georgia" fontSize="10" paddingTop="3" width="615" textAlign="center"/> 
<s:Button label="X" id="btnExit" fontSize="10" chromeColor="#A11C1C" color="#FFFFFF" fontWeight="bold" width="28" height="14"/> 
</s:controlBarContent> 
<s:Label id= "tmpLbl" text= "A" backgroundColor= "16777215" color= "0" fontSize= "144" x= "144" y= "52" width= "111" height= "135" fontFamily= "Arial" fontWeight= "normal" fontStyle= "normal" textDecoration= "none" includeIn= "s1"/> 
<s:RichEditableText id= "tmpRch" x= "192" y= "216" width= "317" height= "171" editable="false" text= "erjhjhfglkjedbfgkljehfkgjnedfkgjheg 
google" 
includeIn= "s1"> 
<s:TextFlow xmlns="http://ns.adobe.com/textLayout/2008"> 
    <s:p color="#000000" fontFamily="Arial" fontSize="12" kerning="auto" leadingModel="approximateTextField" lineHeight="2" textAlign="left" trackingRight="0"> 
    <s:span>erjhjhfglkjedbfgkljehfkgjnedfkgjheg</s:span> 
    </s:p> 
    <s:p color="#000000" fontFamily="Arial" fontSize="12" kerning="auto" leadingModel="approximateTextField" lineHeight="2" textAlign="left" trackingRight="0"> 
    <s:a href="http://www.google.com" target="_blank"> 
     <s:span>google</s:span> 
    </s:a> 
    </s:p> 
</s:TextFlow> 
</s:RichEditableText> 
<mx:Image id= "tmpImg" x= "122.2" y= "143.35" width= "468" height= "175.6" source= "http://www.google.com.tr/logos/classicplus.png" 
includeIn= "s2"/> 
</s:Application> 

回答

3

最后,我找到了解决办法。

首先,我的理解这个问题是特定于某些地区。问题是定义here

看来这个问题是土耳其语言环境中很常见(电脑,其中一个OS是土耳其)

这是我如何解决了这个问题:迫使该mxmlc的使用运用英语的java虚拟机语言环境。我发现我的SDK使用的JVM的jvm.config并添加了行-Duser.language=en -Duser.location=us。现在它工作了!

我希望这个解决方案适用于每个人谁具有相同的问题。

Regards

1

尝试执行以下操作:

mxmlc -version 

调用mxmlc相同的方式,你在命令行编译。输出什么版本号?它应该至少4.0。

+0

对不起,我忘了提及我的Flex SDK版本是4.0.0。任何想法为什么会抛出这样的错误? – 2011-05-13 17:43:10

+0

你使用绝对路径给你'mxmlc'还是使用环境路径设置运行?是否有可能你认为你使用4.0,但实际上它是3.x?您是否尝试使用'-version'参数调用以确保? – Constantiner 2011-05-13 17:46:26

+0

我使用以下绝对路径:C:\ Program Files \ Adob​​e \ Adob​​e Flash Builder 4 \ sdks \ 4.0.0 \ bin。我也援引 - 版本来确保。该版本是4.0.0。 – 2011-05-13 17:56:10