Sunday, August 09, 2009

Debugging TLF source code

Best way to understand what code is doing is to debug it and call certain methods, put some breakpoints and see what is happening inside functions. TLF source is separated in 4 different projects and flash builder allows to add only single source path(as of now in my understanding). So, to debug the source, I had to do few settings to make it work.
I was getting the error 1120: Access of undefined property debug. Then I explored the build file(ant script), which is used to build the swc file. There I found two arguments passed to compc:
<define name="CONFIG::debug" value="${dbg}"/>
<define name="CONFIG::release" value="${rel}"/>
greenshot_2009-08-06_17-16-24
Now, what define does ?
compiler.define: define a global AS3 conditional compilation definition, e.g. -define=CONFIG::debugging,true or -define+=CONFIG::debugging,true (to append to existing definitions in flex-config.xml) -->
I added the following arguments in Additional Compiler Arguments to make my Project problems free.-define+=CONFIG::debug,true -define+=CONFIG::release,false
greenshot_2009-08-06_17-48-12 


 





Then it followed with the following errors:


1046: Type was not found or was not a compile-time constant: ContentElement


1046: Type was not found or was not a compile-time constant: GroupElement


1046: Type was not found or was not a compile-time constant: TextBlock


1046: Type was not found or was not a compile-time constant: TextLine


It was obvious, as these all classes are new, so its a Flash Player mismatch in my settings, after changing my flash player version from flash player 9 to flash player 10, all Problems are gone.





Hope this helps someone who is struggling to debug the tlf source code.