2

I'm trying to build a simple FLEX application. Unfortunately, I get '1131: Classes must not be nested.' errors even with the simples MXML .... the error pops out at the mx:Application openning tag: (I'm using PureMVC if it's important)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:view="icm.view.components.*"
    viewSourceURL="srcview/index.html"
    name="ICM"
    layout="absolute"
    > //FLEX BUILDER SAYS THE ERROR IS HERE


<mx:Script>
        <![CDATA[
        import mx.effects.easing.Exponential;
        import icm.ApplicationFacade;

        public static const NAME:String = "AppSkeleton";
        private var facade:ApplicationFacade = ApplicationFacade.getInstance(NAME);
        ]]>
</mx:Script>

    <mx:Move id="slideInEffect" yFrom="5000" easingFunction="{Exponential.easeOut}" duration="1300"/>
    <mx:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
    <mx:Fade id="fadeIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>

<mx:Style source="css/yflexskin.css" />

    <mx:Canvas id="mainViewStack" left="0" top="0" right="0" bottom="0" >
        <mx:ViewStack id="vwStack" left="0" top="0" right="0" bottom="0" resizeToContent="false" creationPolicy="auto">
            <mx:VBox />
            <view:SplashScreen id="splashScreen" showEffect="{slideInEffect}" hideEffect="{fadeOut}" />
            <view:LoginScreen id="loginScreen" showEffect="{fadeIn}" />
            <view:MainScreen id="mainScreen" showEffect="{fadeIn}" />
        </mx:ViewStack>
    </mx:Canvas>

</mx:Application>

Can someone help me understand why? I've being doing a lot of non-sense tests because I'm not understanding it. Sometimes if I remove the Script section the compilation suceed, others not.

Thanks

Samuel
  • 111
  • 2
  • 11
  • Try building this file with just the SDK and paste the exact error here (the whole traceback). – rfunduk Jan 07 '10 at 23:07
  • 1
    I'm able to compile the above if I remove all of the non MXML code; is there one class (ApplicationFacade), stylesheet (flexskin.css) or component (SplashScreen, etc.) whose inclusion does triggers the error? – Michael Brewer-Davis Jan 07 '10 at 23:42
  • "C:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.2.0\bin\mxmlc.exe" -source-path=src\main;src\assets;src\agenda;sr c\common;src\data -library-path+=libs src\main\ICM.mxml Compiles everything ok, just a bunch of warnings: src\main\ICM.mxml(311): Warning: The CSS type selector 'LinkButton' was not processed, because the type was not used in the application. – Samuel Jan 07 '10 at 23:47
  • 1
    Ouch ... seems to be the problem. Why? Too weird for me. – Samuel Jan 07 '10 at 23:50
  • 2
    I occasionally get these errors and a clean usually does the trick. – James Ward Jan 08 '10 at 02:34
  • 1
    if cleaning the project as suggested by James didn't solve the problem, can you post that css file? – Amarghosh Jan 08 '10 at 07:53

4 Answers4

1

I had this problem using a compiler option to exclude/include some code like -define+=CONFIG::myOption,true when the option is true (resulting including some code), and you have such thing into your code :

CONFIG::myOption {
    import <a package>;
}

this will result in a 1131 error... I have no workaround but not using such conditional compilation directives.

Cédric NICOLAS
  • 1,006
  • 2
  • 12
  • 24
1

Thank you all for the comments.

The greatest tip at this topic is: build with the SDK!!!

Flex Builder (both, the IDE and the Plugin) seems to lack a lot of features on error treatment and even when it reports an error it's not reliable.

A prompt window for compiling used with the IDE saved me a lot of headaches.

Thank you all again!

Samuel
  • 111
  • 2
  • 11
0

http://blog.gigantt.com/2011/02/how-to-build-flex-sdk.html

Building Let's create a batch file to set some useful envars: envars.bat

      set JAVA_HOME=c:\Program Files\Java\jdk1.6.0_23
      set PATH=c:\dev\ant\bin;%PATH%
      set ANT_OPTS=-Xmx256m

Open cmd.exe and run it... Edit c:\dev\sdk\frameworks\build.xml Look for: And fix the location of the manifest file from: "${datavis.dir}/manifest.xml" to: "${datavis.dir}/manifest_datavisualization.xml" Run Ant:c:\dev\sdk\frameworks> ant It should end with such a message: BUILD SUCCESSFUL Now let's tell Flash Builder where to find this new SDK: c:\dev\sdk Add it to the "Installed SDKs" settings in Flash Builder Make sure your project is configured to use this SDK (it was probably created with the original one and still refers to it). Rebuild your project. It should work.

0

There is a flex compiler option "Enable Strict type checking" just de-select it. I think that can give so a simple solution....

uday
  • 1