Donnerstag, 27. Oktober 2011

Using css in a Flex Library Project

Tested with Flash Builder 4.5.1

To make it work with Flash Builder:
  • File must be named defaults.css (not default.css!)
  • Must be checked as "Asset" in the Flex Library Build Path (Flash Builder)

  • For ant

    Note: the file defaults.css should be directly in root of your source-folder (might be "src").
     
       
         
         
         
       
     
    
    For further information: http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_22.html

    Example for css and usage

    Note: You do not need to import the defualts.css in any of your library-mxml-files because the defaults.css is used as default as the name already says.
    
    defaults.css
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/mx";
    
    .userDataFormStyle s|FormItem
    {
    skinClass : ClassReference("spark.skins.spark.StackedFormItemSkin");
    }
    
    The style will be applied to:
    
    
    
    
    
    
    
    
    

    Montag, 17. Oktober 2011

    Chaining your ant build files - common build problems


    This is a small collection of problems that might appear for the first time, when you start to chain your build files to build up the magic button: build all projects and create deployable.

    Example how to build the top-level-chain:
    
     
     
       
      Calling ant build for client module core... 
      
      
      ...
      
      Calling ant build for the client application... 
      
      
      Calling ant build for the server... 
      
      
     
    
    
    


    Heap space problems

    Error:
    Not enought heap space
        [mxmlc] Fehler: Java heap space

    Solution:
    Add the jvmargs for heap adjustment to the mxmlc-Task and set fork to true. Example:
    <mxmlc ...="" fork="yes" jvmargs="-Xms512m -Xmx512m">




    Accidently forked?
    Error:
    BUILD FAILED
    java.io.IOException: Cannot run program "javac.exe"
    ...
    ... build.xml:41: Error running javac.exe compiler
    ... org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)

    Solution
    <javac ...="" fork="false">


    Forgot to fork?
    Error:
    ...\build.xml:13: compc task failed
    Solution:
    <compc ...="" fork="yes">

    Problems with flex-config.xml
    Error:
    [mxmlc] command line: Fehler: „flex-config.xml“ konnte nicht geöffnet werden
    ...\build.xml:47: mxmlc task failed
    Solution:
    <mxmlc ...="" fork="yes"></mxmlc></compc></javac></mxmlc>




    Dienstag, 4. Oktober 2011

    Building Flex library projects with ant

    Building flex lib projects with ant is very easy. To make it even easier just use the following as template...

    Tested with: Flex 4.5 and ant 1.7 within the Eclipse IDE (3.6)
    
    
     
    
     
    
    
     
     
     
    
       
         
           
            
           
         
       
      
       
          
       
    
     
      
     
      
        
    
    
    

    ActionScript HTTPService - a common error - Error #1090

    If your application is quite fine but someday you get an error like this: Error #1090: XML parser failure: element is malformed
    Then you might have just missed to explicitly set the resultformat to something different than the default which is xml in Flex 4.5.

    So the snippet with the fix in the last line is:
    var service: HTTPService = new HTTPService();
    service.url = url;
    // note: default seems to be xml. XML seems to work for most cases but crashes for exmaple if a json response contains the character '<'
    service.resultFormat = "text";
    
    
    

    For the folks that thought as I did for the first time - here a short reminder: Flex does not care about the correctly set response type of your reponse. You have to set it manually as seen above.