Flex Development Engineers Wanted @ a Startup Team @ Beijing

February 24th, 2010

Job Title |职位名称
Intermediate/Senior Flex Development Engineer |/高级Flex开发工程师

Job Vacancy |职位空缺
2 - 3 persons | 2 - 3名开发工程师

Job Location | 工作地点
Chaoyang District, Beijing | 北京朝阳区

Position Type |职位类型
Full Time |全职

Job Description |职责描述
1.Develop Flex RIA industry-oriented applications | 使用Flex开发行业应用程序
2.Write relevant development documents | 撰写相应的开发文档
3.Assist in design and develop product functions | 协助产品功能的设计和开发
4.Fix bugs, test units in order to improve the overall performance of the application | 为提高产品的整体质量修改产品缺陷,参与测试

Requirements | 职位要求
1.Basic Knowledge: HTML, CSS, and JavaScript | 扎实的基础知识:HTML, CSS, and JavaScript
2.Technologies
Flex, flash platform, AS 3.0, OOD | 熟练掌握如下技术:Flex, flash platform, AS 3.0, OOD
3.1.5  year + direct working experience using Flex |
一年半以上的实际开发经验
4.Be able to write development documents for the application | 擅长撰写开发文档
5.You MUST be a fast learner, trouble shooter, team player | 你必须是一个学习能力强、解决问题能力强、善于团队合作的人
6.Enthusiasm for what you do | 拥有技术热情
7.Good written and reading English skills | 熟练的英语读写能力

Apply Now | 申请方式
Please send your CV to: talentseeker2009@gmail.com | 请将简历发送至talentseeker2009@gmail.com
Please feel free to contact us by 1194278957 (QQ) or send us a email if you have any inquiries | 欢迎QQ联系1194278957或者邮件联系我们


To Support Cookies, Using Flexmojos with Firefox to Run Unittests for CI Server(Hudson) in Headless Environment

February 20th, 2010

Flexmojos is a convenient tool used to compile and test flex applications. However, when running unittests in headless linux with Hudson, I met a problem caused by cookies. The server side needs cookies to make sure requests are valid. I googled a lot and find such a solution finally.

  1. you are required to install xvfb according the instructions in this article.
  2. you must have firefox 3.x.x installed.
  3. navigate to “about:config” in firefox and set “dom.allow_scripts_to_close_windows” to “true”;
  4. register executions for flexmojos-maven-plugin like this:
    <executions>
    	<execution>
    		<id>default-test-compile</id>
    		<configuration>
    			<useNetwork>false</useNetwork>
    		</configuration>
    	</execution>
    
    	<execution>
    		<id>default-test-run</id>
    		<configuration>
    			<flashPlayerCommand>firefox</flashPlayerCommand>
    		</configuration>
    	</execution>
    </executions>
  5. download proper SWC according to the flexmojos version here. For example, I am using flexmojos 3.5.0, so I choose to download flexmojos-unittest-support-3.5.0.swc.
  6. checkout source code of flex-unittests-support with svn here.
  7. create a flex library project with flex(flash) builder called “flexmojos-unittest-support”, a sample project you can find here.

      flexmojos-unittest-support.rar (40.6 KiB, 12 hits)

  8. modify function exitFP defined in class org.sonatype.flexmojos.unitestingsupport.ControlSocket:
    		private function exitFP( event:* ):void
    		{
    			//Exiting
    			trace("Exiting");
    			if(ExternalInterface.available)
    			{
    				var functionStr:String = "function()" +
    					"{" +
    						"window.opener=null;" +
    						"window.open('','_self');" +
    						"window.close();" +
    					"}";
    
    				ExternalInterface.call(functionStr);
    			}
    			else
    			{
    				fscommand("quit");
    			}
    		}
  9. add flexmojos-unittests-support-x.x.x.swc as a library of this project.
  10. compile and build flexmojos-unittest-support.swc.
  11. install flexmojos-unittest-support.swc into maven repository according to the version of the flexmojos being used. For example, I am using flexmojos-3.5.0, so I run the command below under the bin directory of the flex library project:
    mvn install:install-file -DgroupId=org.sonatype.flexmojos -DartifactId=flexmojos-unittest-support
    -Dversion=3.5.0 -Dpackaging=swc -Dfile=flexmojos-unittest-support.swc -DcreateChecksum=true
  12. now, you can run unittests with hudson supporting cookies.

NOTE: The javascript code used to close the browser can work with firefox, can not work with IE8. I do not test the other browsers.


    Count attributes amount within one E4X expression

    February 10th, 2010
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768"
    				creationComplete="application1_creationCompleteHandler(event)">
    	<mx:Script>
    		<![CDATA[
                import mx.events.FlexEvent;
                import mx.utils.ObjectUtil;
    
                protected function application1_creationCompleteHandler(event:FlexEvent):void
                {
                    var myXml:XML =
                        <deals name="bbs" type="C">
                            <deal name="sf" id="3" type="D"/>
                            <deal name="fdsf" id="1" type="E" description="testtest">
                                <deal name="basdf" id="2" type="A"/>
                            </deal>
                        </deals>;
                    var names:Object = {};
    
                    var attributes:XMLList = myXml..@*.(names[localName()] == null ?
                                                        names[localName()] = 1 :
                                                        names[localName()]++);
                    trace(ObjectUtil.toString(names));
                }
            ]]>
        </mx:Script>
    </mx:Application>

    The output should be:

    (Object)#0
      description = 1
      id = 3
      name = 4
      type = 4

    Default stylesheet in an SWC (Flex Library Project), and embedded font rotation

    February 4th, 2010

    This article comes from “Flex and ActionScript Development Tips


    For ages now I’ve been trying to figure out how I can use a StyleSheet from inside my Flex Library Project in ActionScript. I kept reading that it is very resource intensive to be calling UIComponent.setStyle(…) at runtime, so I wanted to set all my styles using a StyleSheet. The LiveDocs on the subject seem to say that there are two ways to load a StyleSheet:

    1. From inside MXML in your Application using the <Style source=”assets/styles.css“/> tag
    2. By loading an external stylesheet SWF file (compiled from a CSS file) using the
      StyleManager. loadStyleDeclarations(url)

    Then I finally found the solution in this article (right near the bottom of the page in the comment by Henk). And that pointed me to this LiveDoc - Applying styles to your custom component which solved the problem. Scroll most of the way down until you get to the part called “Applying styles from a defaults.css file”.

    If you don’t want to read the articles above, here is my brief summary.

    Using a StyleSheet in your FlexLibrary Project:

    1. create a StyleSheet in the src directory of your project, and call it defaults.css
    2. open the project Properties > Flex Library Build Path and check the src/defaults.css file under the Assets tab
    3. define your styles inside the defaults.css StyleSheet

    Restrictions:

    • You can include only a single style sheet in the SWC file
    • The file must be named defaults.css
    • The file must be in the top-most directory of the SWC file

    *Note: it appears that having a defaults.css file in your Flex Application project (swf) also works without having to specify the stylesheet in the mxml (e.g. <mx:Style source=”defaults.css“/> is not needed).

    Using Embedded Fonts inside Flex Library Project/SWC:
    If you want to use an embedded font inside your library project you have two ways of doing this:

    1. Embed the font inside an ActionScript file like this (the font is inside the project src/assets directory):
      [Embed(source='/assets/verdana.ttf'fontName='localVerdana',
      mimeType='application/x-font')]
      public var verdanaFont:Class;

      setStyle(“fontFamily”, “localVerdana”);
    2. Or put your embedded ttf font in your project’s src directory and embed the fond using the defaults.css file (the font must be in the src directory for this to work - see this Adobe Bug for more details):
      defaults.css:

      @font-face {
      font-familylocalVerdana;
      font-weightnormal;
      srcurl(“verdana.ttf”);
      }
      .label {
      /* must use embedded font for label rotation to work */
      font-familylocalVerdana;
      /* must specifically set the font weight */
      font-weightnormal;
      }

    Note that if you want to set the DisplayObject.rotation property then you have to use an embedded font otherwise it doesn’t work.

    Here is a simple example of font/label rotation (right click “View Source” for the code).
    In this example I actually included three fonts - Verdana plainVerdana bold, and Comic Sans.

    * Note that fonts can greatly increase the size of your SWF. The three fonts that I used above are all about 150 KB each. One way to reduce the size of your SWF is to restrict the unicode character range (meaning that only part of the font set is included in your SWF). Here is the LiveDoc on Using Fonts and Setting Character Ranges.


    成为敏捷软件开发人员的三个关键见解

    January 22nd, 2010
    1. 你不必非要做一个超人
    2. 敏捷性其实只是思维集
    3. 成为一名博学型的专家

    ——Scott W ● Ambler