Remove trace using Flex SDK

Trace removal.

I get asked this question quite often so I thought I would post the answer out there just because not too many developers are either sharing this or savvy on this. It’s less than perfect but is very good for a final release where you don’t want to have traces being fired from your project to improve performance for the playback of your Flash movie. I use the ant feature quite often in Eclipse in order to automate various development tasks and I am certainly not an expert at using ant yet but I am always finding it very useful and hungry to learn more. The code is rather basic all you need to do is run a regular expression over all your .as files to remove all instances of the trace function by adding this into an ant xml. It goes a little something like this :

<target name="removeTrace">
<replaceregexp match="trace(.*?);" replace="" flags="gs">
<fileset dir="${classesdir}" includes="**/*.as"/>

Related Post