0

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>
Ugur Adigüzel
  • 203
  • 1
  • 2
  • 13

2 Answers2

4

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

Ugur Adigüzel
  • 203
  • 1
  • 2
  • 13
1

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.

Constantiner
  • 14,231
  • 4
  • 27
  • 34
  • Sorry I forgot to mention that my Flex SDK version is 4.0.0. Any ideas why it throws an error like this? – Ugur Adigüzel May 13 '11 at 17:43
  • Do you use absolute path to you `mxmlc` or it runs using environment path settings? Is it possible you're thinking you're using 4.0 but in real it is 3.x? Did you tried invoking with `-version` parameter to make sure? – Constantiner May 13 '11 at 17:46
  • I am using the following absolute path : C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.0.0\bin . I also invoked -version to make sure. The version is 4.0.0. – Ugur Adigüzel May 13 '11 at 17:56
  • Could you please try to compile the same code above in your command like with flex 4 sdk. I wonder if you will also get the same error – Ugur Adigüzel May 13 '11 at 17:57
  • I've compiled it without any problem from command line with SDK version 4.1.0 build 16076. – Constantiner May 13 '11 at 18:59
  • It is very strange. I just tried it with also both SDK version 4.1.0 build 16076 and 4.5.0. build 20967. But it still gives the same error. I don't know what the difference can be. I am using "SDK bin path> mxmlc " to compile. – Ugur Adigüzel May 13 '11 at 22:29
  • In my case I first set directory with target application MXML file as current in terminal and then run `absolute_path_to_mxmlc MyApp.mxml`. – Constantiner May 14 '11 at 10:59
  • I also tried that now but still the same error. I am stuck at a crucial point for my senior project :s – Ugur Adigüzel May 14 '11 at 12:35
  • Try to reproduce compiling from scratch. Download SDK and unzip it in a new catalog, create new catalog for your source file, try to compile again. BTW what operation system do you use? – Constantiner May 14 '11 at 13:29
  • @Constantiner , I already downloaded and unzipped 3 different versions of Flex SDK(4.0 and higher). I tried different source codes which are generated by Flex Builder and which contains `` type components. Moreover, I tried this on 3 different computers, always the same errors. All of them has Windows 7 OS(language: Turkish). I don't really know what to do :( – Ugur Adigüzel May 15 '11 at 21:30
  • Have you any other computer around? Maybe some colleges? Just to compare. – Constantiner May 16 '11 at 07:30
  • @Constantiner, I found the reason for this problem and posted the solution as a reply to this post. It was apperantly because of Turkish locales and I solved it by adding some arguments to jvm config file. Thanks anyway, – Ugur Adigüzel May 16 '11 at 12:51