Sunday, August 9, 2009

FDT - Customize Your Workflow

We all come across things that end up saving us lots of time when used over and over again. If you use FDT, there are countless options available to enhance a development work-flow. Here are some of mine:

[NOTE: This is a combination of an old blog post I did (before my database blew up) and some new stuff thrown in]

  • Speed up code assist Link

  • Know about compiler options. You add these at "Run [ Debug ] Configurations>Compiler Arguments.  Adobe''s Reference.

  • Quickly navigate your errors by assigning a keystroke to 'Show View (View:Problems)'. This way, when FDT tells you about an error, you can quickly open the 'Problems' view then use the down arrow to scroll to a problem.  If you want FDT to then  jump to that problem in the editor, scroll to it and hit enter.

  • Check out Powerflasher's list of short cuts: Link

  • Use FDT's built in file history. I'm always deleting files or changing them in some way. Sometimes I may want to go back to an older version.  FDT saves local histories of your files. To get to this, Right Click On File>Compare With>Local History. You can also restore deleted files in a similar fashion. Right Click On Directory>Restore From Local History...

  • Share your launch configurations and create projects form SVN repositories. FDT allows you to export your launch configurations to share with others. At my company, a freelancer came in to work with us on a project.  He had FDT with SVN.  I gave him the SVN URL and project name. He was up and compiling in about 30 seconds, and we were all in sync. No joking.

  • Keep an eye on memory usage and garbage collection. Do this by viewing the heap status. Preferences>General>Show heap status.

  • Have FDT auto-refresh your project. Sometimes I'll add files to my project via the Finder [Explorer] or have some ANT file build HTML files.  By default, files added in this manner take a little time to show up in FDT's project explorer.  Change this by telling FDT to auto refresh: Preferences>General>Workspace>Refresh automatically.

  • Add "Explore in File System" plugin. This way you can have FDT open files for you in your native file explorer. Get it here. Thanks to Riccardo Bartoli for finding this.

  • FDT does not come with the fl ( fl.* ) package. To get it, how to add it, as well as see why it is omitted; Go here.

  • When compiling your FDT application for release, use ''Run'' not ''Debug''. When in debug mode, the Flex Compiler Shell will add ( a little ) extra code to your .swf. See other config options such as ''optimize=true|false".

  • Use JIRA to submit bugs and feature requests. This helps out everyone. It has a voting system, so it''s all very transparent. Powerflasher''s Jira.

  • Assign key bindings to stop debugging and quickly switch from debugging to editing code. When your app crashes or when you hit a break point and enter the debugger, you can have a way to easily get back to editing.  I have assigned key bindings to ''Next Perspective'' , ''Previous Perspective'' and ''Terminate''. The workflow is: Hit break point>FDT switches perspective>use ''Terminate" key stroke> then ''Next ( or Previous ) Perspective'' key stroke and I am back to editing in no time.

  • When close to a web release use FDT's compiler settings to open and test in a browser using a localhost web configuration. This way you will know how formatting will look and know of any network/sandbox errors. This is also a good place to test and bebug in various browsers before having to load it to an online server for testing. Go to Run [Debug] Configurations>FDT AS3 Application>Start>Open URI after compilation.  Then enter your localhost URL, e.g. 'http://localhost:8888/FDT_Project/index.html'

  • Use multiple source folders and/or linked libraries to turn off and on sections of code. This is handy when using code bases you don't/can't edit and who are riddled with errors or warnings. FDT will parse all source folders which can really slow down things if there are many classes with errors. Many open source libraries were written in IDEs that don't have FDTs live error checking.  Use them as linked libraries or keep them in a separate folder and use add/remove the folder to your source ( Right Click Project Folder > Source Folder> Add/Remove from class path ). This also helps In a team environment where you want to sandbox your code from the team. Create your own source folder then check out your teams folder to a seperate folder.  When you are ready to update to your team copy and paste your files from your source folder to the ''team'' folder you checked out. The same goes for linked libraries.

  • Close projects that you are not using. Otherwise these folders will consume resources as FDT will parse them and they will also use memory.

  • Code completion for Vectors occurs after the ''<''. Example: var myVector = new Vector.<[hit your code hinting key].

  • Use Javadoc / ASdoc commenting then use auto complete to get a list of available commands to insert. Link to Adobe''s site.

  • Target Flash Player 10 by adding the compiler option ''target-player=10.0.0'' .

  • Use ''//TODO:'' to assing tasks to yourself and others. This comment you add will pop up in the ''Tasks View''

  • Add key bindings to ''Next Editor'' , ''Previous Editor'' , ''Forward History'', ''Backward History''. Use ''Next/Previous Editor'' to navigate to another file that is open, then edit that file, then use ''Backward History'' to automatically jump back to the line your were at in the other document.

  • Know how adding SWCs of art from Flash Authoring to your application can really increase your options.

  • Know ANT and why it rocks.  Blog post about this coming soon.

  • Use "Always launch the previous launched application". This is found via Preferences>Run[Debug]>Launching. This way you can bind "Debug" or "Run" and always be sure your loading the same launch configuration.

  • Understand that there are different core libraries to choose from.  For example when using Flex meta tags make sure you are not using the the sdk with ''Pure'' in its title, and when building an AIR app, use the sdk with AIR in it''s title.

  • When creating a project, click ''Create separate folders for sources and binaries''.  This will help keep your editing code and launched files separate.

  • Make testing easier by using multiple launch configurations.  When building and testing various small components, don''t worry about building them all into one file, create multiple ''Main" classes and corresponding launch configurations.

  • When creating custom templates assign your own variables. Use the syntax ''${args}'' where ''args'' can be replaced with anything you want such as ${name_of_class}. This can help you and others remember what kind of variable to put in. You can also chain your custom variables together. If you have one variable in one place, and the same one in a different place, editing one will effect the other.

  • Create and use multiple workspaces. As I build more and more applications, I don't want my Projects View to come cluttered with projects.  Group projects together into workspaces and then switch in between those workspaces as needed.

  • Share preferences across different workspaces. Go: File>Select File>Export>Other>General>Preferences. Click 'Next', check 'Export all'.

  • Export and share templates.

  • Use FDT's Dynamic Help. This is found in Help>Dynamic Help>All Topics (at the bottom of window)>FDT.

  • Use the -clean start argument if FDT is acting flaky. On Mac go:Right Click FDT>Show Package Contents>Contents>MacOS>FDT 3.ini.  Open the file and add the line '-clean' in below '-vmargs'. On Windows this can be added in the Explorers 'properties' view.  Click the 'Shortcut' tab and add arguments into the 'Target' field.