Archive for November 19th, 2007

F.D.T. 3.0 + Code Templates

The folks over at F.D.T. were kind enough to bestow me with an enterprise license for the QueueLoader and SoundManager project. Many thanks to them! I had dabbled with the beta version, but haven’t had much of a chance to get back into the FDT world until recently. Now that I have been using it again, I remember how much I hate coding in the IDE. Here’s some info to get you up and running.

Installing or updating to the new version is a breeze. Whereas before you needed to link a special FDT modified code library, now it automatically links to the global SWC file.

When installing or upgrading to 3.0 you’ll need to do this: (I’m on a Mac so if you are on a PC, you’ll need to find instructions.)

  • Right click on the eclipse application and select show package contents. Open Contents/Mac Resources/Eclipse.ini and change -Xms40m to -Xms256m and -Xmx256m to -Xmx512m

Code Templates: Code templates or code snippets are one of the many ways to work quickly within FDT. Go to preferences FDT>Editor>Templates and click New and you can set up a new code template. The template will let you insert java variables that will automatically be replaced with page elements. ${enclosing_type} will turn into the Class name. ${enclosing_method} will turn into the function name. Once you have the templates set up when you are coding in a class you press control and space and the template menu will come up. Start typing the code template name and hit enter and there is your code snippet with the variables replaced by it’s respective names. Here are some of my favorites you can paste into the template window:

Trace:

trace(“>> ${enclosing_type}.${enclosing_method}() - args: “+[${enclosing_method_arguments}]);

Public Method:

public function ${methodName}():${type} {
    trace(“>> ${enclosing_type}.${methodName}() args: “+[]);
    ${cursor}
};

Browser Based Alert Debugging:

SendJavascript.getInstance().debug(“${enclosing_type}.${enclosing_method}()”);

Go here for info on this one.

Monday, November 19th, 2007

ADDED_TO_STAGE + IE6 + Debugging

Let me start off by saying Event.ADDED_TO_STAGE does NOT work in IE6. I spent the better part of today debugging to finally track the culprit down to this event. This flip side to this is I figured out a gorilla method for debugging and getting to the source of the problem.I added a method to my SendJavascript singleton class called debug() that fires an ExternalInterface function (I might convert the rest of the class tp ExternalInterface at some point if I find it works better then the way it is now). This in turn is connected to a javascript that generates an alert box. Surprisingly enough, when the alert box would popup on screen, the code running in the SWF would stop. By moving this method around my application I was able to figure out that if the alert came up all was well. If it didn’t come up then I knew it was located beyond the trouble spot. By continuously narrowing the bookends of the alert calls I tracked the issue down to the event. Reminded me of using signal flow to track down a hum in an audio path.I took it a step further and created an F.D.T. code template that allowed me to insert the call. This made it speedy as it would automatically insert the class method and the enclosing method.Here’s the template code:

SendJavascript.getInstance().debug(“${enclosing_type}.${enclosing_method}()”);

Here’s the script added to the html:

<script language=“JavaScript”>
function sendToJavaScript(value) {
     alert(value);
}
</script>

Here’s the updated Class:SendJavascript Debug UpdateYou can see more info on this class as well here.

Monday, November 19th, 2007