Category Archives: Useful

Fix for Flash Builder Content Assist 'did not complete normally'

One of the best features in Flash Builder is the content assist. Start typing a class name and hit Control+Space for the IDE to suggest a list of valid class names. As a bonus it will automatically import the specified class into your file. Unfortunately in Flash Builder Beta 2 this functionality is broken in some cases. Often you will get an error like this:

“Content Assist” did not complete normally. Please see the log for more information. java.lang.NullPointerException

I found a solution that worked for me here:

1) Quit FB
2) Delete this folder: .metadata\.plugins\com.adobe.flexbuilder.codemodel [in the top level of your workspace folder]
3) Restart FB

[UPDATE – this fix seems to be only temporary. Once I imported some new assets from an assets SWC into my project, the error re-appeared. Anyone got a long term fix?]

[UPDATE 2 – The quickest fix is to close and re-open the FB Project.]

SimpleViewer 2.0 Released!

Big news over at SimpleViewer.net – SimpleViewer, the free customizable Flash image gallery has been upgraded to version 2.0. Check out a run-down of the new features here and grab yourself a copy here.

Flash Developer Toolbox Essentials

Toolbox
Image by Robert S. Donovan.

When working with other Flash developers, I am sometimes surprised when they are not aware of some dev tools that I consider essential. I thought it would be useful to list out the tools that I use everyday as a Flash Developer. All of these tools are free and cross-platform unless otherwise stated. None of this will be news to the seasoned Flash devs, but some will find it useful. Let me know in the comments if I’ve missed anything.

Applications

Desktop apps and browser plugins.

  • Firebug. This firefox plugin lets you view a HTML page’s elements load in realtime, among other things. Great for debugging dynamic data loading into a SWF. Essential for any web developer.
  • Flash Tracer. Firefox plugin to view your SWF traces in the browser. Invaluable.
  • MAMP (Mac) and WAMP (PC). MAMP is a one-click install personal webserver for the Mac. WAMP is the same for Windows. Useful for debugging load timing issues on your own box, especially when combined with a web-proxy throttler.
  • Charles and ServiceCapture. These web-proxies allow you to view your SWF’s dynamic data loads in realtime. They also offer throttling, which lets you simulate slow web connection speeds (both are not free).
  • IETester (PC). Allows you to run IE8, IE7 IE 6 and IE5.5 on Windows 7, Vista and XP. Good for debugging IE6 weirdness.
  • Flash Builder. Everyone has their own favorite ActionScript editor, and this is mine. If you are still coding in the Flash Actions panel, now is the time to stop – you won’t regret it! Flash Builder is an Adobe product so you know it’s going to be well maintained. As a bonus it uses the industry standard Eclipse UI, so the shortcuts you learn with it can be transferred over if you choose to develop in some other programming language later (not free).
  • Versions (Mac) and Tortoise SVN (PC). Source control is not necessary for smaller projects, but if you value your dev time and want to be able to keep multiple versions of your code available, it is a must. Versions (not free) is the nicest SVN client ever, and Tortoise is the most popular Windows SVN client.
  • Free Ruler(Mac) and JR Screen Ruler (PC). These little apps allow you to measure pixels on the screen without having to do a screen grab.
  • Pathfinder (Mac). A Finder replacement that is hard to live without once you are used to it. Includes tabs and a split pane for dragging and dropping. Not really a Flash dev specific tool, but I’ve seen enough people be amazed at seeing tabs in the Finder that it was worth including here (not free).

Flash Libraries

Why re-build the wheel? There are tons of great, free ActionScript libraries made available by generous and talented developers.

  • TweenLite. The fastest, most robust and easiest to use Tween library out there.
  • Away3D. The best 3D library out there. Although Papervision seems to win all the awards, from my experience Away3D has the most features and has the best documentation. Also has a great user forum.
  • casalib. A great collection of robust utility classes. Check here before writing that utility class!
  • SWFAddress. Has quickly become an industry standard for building flash sites that support deep-linking. Handles lots of gnarly browser specific issues so you don’t have to. Built on SWFObject which is so useful I didn’t even list it here 😉
  • Hi-ReS! Stats. A very handy little class to show when your SWF framerate is choking.
  • BIT-101 MinimalComps. A set of ActionScript-only UI components for use in non-Flex projects. Very easy to use and small in filesize. The code is also worth looking at to see how to build a super simple component framework.
  • as3corelib. A collection of utility classes by Adobe for handling encoding and serialization among other things.

Bookmarks

To round out this list, here are 3 webpages that I am always hitting:

Better Flash Asset Loading using SWCs

One problem with Flash development recently is the disconnect between assets created in the Flash IDE and code written in the code editor (Flex Builder, Flash Develop, FDT etc). The code editor has no knowledge of the FLA, so there is no way to list the FLA’s exported symbol linkage ids or the names of movieclips within a symbol instance (sub-clips). This can lead to lots of back and forth between Flash and the code editor, tracking down missing or misnamed symbols and sub-clips.

For AS projects, Flash assets are typically loaded by using ‘Embed’ metatags, using ‘getDefinitionByName’ or using something like Grant Skinner’s FlashLib. I recently found out about an alternative method via a comment on Ian Lobb’s blog, which is to use SWCs.

It turns out that using SWCs solves the above issues for very little extra setup. Using SWCs means the compiler knows about the FLA and gives code completion on symbol names and sub-clips. Anytime the compiler knows about stuff, it’s going to save you debugging time by flagging errors before they happen. Symbols also retain their timeline ActionScript (unlike using Embed tags).

Example usage:

[as] //import symbol from FLA
import assets.MySymbol1;

//Instantiate symbol instance
var clip:MySymbol1 = new MySymbol1();
//access symbol’s sub-clip properties
clip.mcGreen.alpha = 0.5;[/as]

Example Flex Builder code completion:

SWC Symbols

SWC subclips

Where this technique gets really interesting is with Flash Builder 4’s Package Explorer. This allows you to browse inside a SWC and view all exported symbols and sub-clips.

package explorer

This technique can be used with any smart AS editor. The set-by-step for Flash Develop is here. For Flex Builder you want to do something like this:

  1. In Flex Builder, create a new AS project.
  2. In the project folder create a new FLA: ‘assets/assets.fla’.
  3. In the Flash publish settings, check ‘Export SWC’.
  4. Create a symbol in the FLA. Set the Linkage id to: ‘assets.MySymbol’.
  5. Publish the SWC.
  6. In Flex Builder do Project -> Properties-> ActionScript Build Path -> Library Path -> Add SWC. Enter the path to the SWC (‘assets/assets.swc’) .
  7. In Flex Builder, edit the main class. Type ‘import assets.’. The symbol name you defined in the FLA will now show as a code completion option.

Anyone know of any disadvantages of using this method?

Another Reason to Love TweenLite

I just found a useful function in the TweenLite library, which is great for easily sequencing multiple function calls. To call myFunction() in half a second with param1 and param2, do this:

[as]TweenLite.delayedCall(0.5, myFunction, [param1,param2]);[/as]
which is a lot less code than:
[as]var tmr:Timer = new Timer(500, 1);
tmr.addEventListener(TimerEvent.TIMER_COMPLETE,onTimerEvent);
tmr.start();
private function onTimerEvent(event:Event):void{
myFunction(param1,param2);
}[/as]

TweenLite seems to have quickly become something of a Flash standard. It’s a great library that is well maintained and just works.

PercentMobile – Free Mobile Analytics

My buddy Stan Wiechers just launched a supercool new service that provides Free Mobile Analytics – PercentMobile. Check it out if you want to see how many of your users are viewing your site on a mobile device and what kind of device they are using. To sign up you can use the invite code “airtight” (good for 100 invites).