开发者

could not resolve <fx:Declarations>(or <fx:Script>) to a component implementation

开发者 https://www.devze.com 2023-03-05 13:30 出处:网络
I am trying to compile a file into swf using mxmlc in command line. When it is a very simple mxml, compile is successful. But when the file contaion the fx name space, I get a compile error like: coul

I am trying to compile a file into swf using mxmlc in command line. When it is a very simple mxml, compile is successful. But when the file contaion the fx name space, I get a compile error like: could not resolve (or ) to a component implementation.

I have to be able to do this, without the help of Flash Builder because I am working on a project where I will need to generate swf files from mxml files of which we generate the code.

Any suggestions?

The code I am trying to compile is:

<?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>


Finally, I found a solution.

First of all, as I understand the problem is specific to some locales. Problem is defined here

It seems this problem is very common in Turkish locales(in computers where a OS is Turkish)

Here is how I solved this problem: forcing the java virtual machine that mxmlc uses to use English locale. I found the jvm.config of JVM that my SDK uses and added the lines -Duser.language=en -Duser.location=us. Now it works!

I hope this solution works for everyone who has the same problem.

Regards


Try to execute the following:

mxmlc -version

invoking mxmlc the same way as you're compiling from command line. What version number is in output? It should be at least 4.0.

0

精彩评论

暂无评论...
验证码 换一张
取 消