Flex Module Debugging

취미 2007/08/30 21:17 iamyhs
1)Cairngorm을 써서 모듈로 개발시 디버깅 코드, 예를 들어 TargetCommand 클래스 라면

public class TargetCommand implements ICommand, IResponder{

    private var csModel:CSModelLocator = CSModelLocator.getInstance();

    ..   
    public function result(data:Object):void
        {
            ..
            if (Application(Application.application ).url.indexOf( "debug" ) >= 0 ){
                //trace("디버그 버전 모듈 로딩");
                csModel.moduleURL = "./offton/view/TargetModule-debug.swf";
            }else{
                csModel.moduleURL = "./offton/view/TargetModule.swf";   
            }
          ...
       }
    ..

}


2)모듈 컴파일시 FlexAnt 속성중에 아래처럼 추가하고,필요할때 해당 모듈만 컴파일해서 디버깅 한다.
디버깅에 필요한 파일은 이름-debug.swf 이므로 아래처럼 debug="true" 하고,${modulename}-debug.swf 해주면 간편하게 쓸수 있다.

예를들어,TargetModule.mxml 이 모듈 컴포넌트이고 이 모듈을 디버깅 파일을 함께 컴파일하고 싶다면,

..
<property name="modulename" value="TargetModule" />
..

<target name="Current Module Compile" depends="NormalModule,DebugModule">      
</target>
   
    <target name="NormalModule">
        <echo>NormalModule 이름은 : ${modulename}.mxml </echo>
        <mxmlc file="${view.main}/${modulename}.mxml" output="bin/${view.main}/${modulename}.swf" actionscript-file-encoding="UTF-8" incremental="true" load-externs="${view.main}/report.xml">
            <compiler.library-path dir="${flexlibtask.project.home}" append="true">
                <include name="swc/Cairngorm2.2.1.swc"/>
            </compiler.library-path>           
            <compiler.source-path path-element="./"/>
        </mxmlc>       
    </target>
   
    <target name="DebugModule">
        <echo>DebugModule 이름은 : ${modulename}.mxml </echo>
        <mxmlc file="${view.main}/${modulename}.mxml" debug="true" output="bin/${view.main}/${modulename}-debug.swf" actionscript-file-encoding="UTF-8" incremental="true" load-externs="${view.main}/report.xml">
            <compiler.library-path dir="${flexlibtask.project.home}" append="true">
                <include name="swc/Cairngorm2.2.1.swc"/>
            </compiler.library-path>           
            <compiler.source-path path-element="./"/>
        </mxmlc>       
    </target>
..


2007/08/30 21:17 2007/08/30 21:17

트랙백 주소 :: http://iamyhs.com/tc/trackback/122

트랙백 RSS :: http://iamyhs.com/tc/rss/trackback/122

댓글을 달아 주세요

댓글 RSS 주소 : http://iamyhs.com/tc/rss/comment/122