Event Handler Style Showdown

There has been some talk on Twitter recently about the best way to write an event handler. This is all in good fun of course as there is no right way to do any kind of code. Flashers come from all walks of life. Some are from the design world and some from serious development backgrounds. Below are some of the suggested ways. What do you think?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
private function kermanStyle(evt:Event):void {
    // this is nice but I don't like evt for some
    // reason. Also it is much more readable and
    // clean to put the opening { on a new line.
}
       
private function sacksStyle(event:Event):void
{
    // Steven rightly puts the opening { on a new
    // line but uses the word event for his event
    // object. You should never use a lowercase
    // version of an existing class for an instance.
}
       
private function brimelowStyle(e:Event):void
{
    // Yeah baby that's what I'm talking about!
    // Using e is short, succinct, and most of all
    // it is the sign of high intelligence.
}

New Video Tutorial On Multi-Touch In Flash

I just uploaded a new tutorial that explains how to respond and handle raw touch data in Flash Player 10.1. In a previous tutorial I showed how to respond to gestures, but in touch mode you can track all of the touch points on your screen. The 3M display that I am using supports up to 60 touch points, although I have yet to think of an example of how to use them all.

Lee


Watch My Sessions From Flash Camp SF

Advanced Text Layout With Flash CS5
I give an introduction to some of the new Text Layout features and functionality in Flash CS5.

Introduction to Multi-Touch in Flash Player 10.1
Flash Player 10.1 introduces a full, native multi-touch API that allows you to create some amazing applications. In this session I demonstrate how to build applications using native multi-touch feedback as well as how to use the built-in gesture support for things like scaling and rotating.

Lee


Increasing The Code Hint Cache Size In Flash CS5

Update: my instructions for Mac got truncated but it is fixed now. Thanks to Kevin Suttle for pointing it out.

You may have read my earlier post about needing to not have too many files in your ActionScript source path in Flash CS5. After a certain number of files is reached, Flash will basically abort. This is to prevent Flash from indexing your entire hard drive if you happen to save your file in the top level of your disk (i.e c:\). Now the limit is actually 800 files by default, but as hardcore Flashers know, sometimes your global AS directory can be much larger. Well luckily there is a way to change this limit.

WARNING: do not change this if you are uncomfortable with editing your registry. Also do not change this and then complain that Flash is running slow when you save your FLA into your root directory of your hard drive.

Windows:

  1. Open Regedit and navigate to: HKEY_CURRENT_USER > Software > Adobe > Flash 11 > Settings
  2. Right+click and choose: ‘New… > DWORD Value’
  3. Rename the key: Project File Cap
  4. Select the key and choose: ‘Modify’
  5. Edit the value as either hex or decimal: 1000
  6. Click OK and restart Flash

Mac:

  1. Open /Users/<username>/Library/Preferences/Flash CS5 Preferences in Text Edit
  2. Under the <settings> section add the following: <project_file_cap>1000</project_file_cap>
  3. Save the file and restart Flash

What should you set it at? Well if you are good about saving your FLA files into their own folders, then it doesn’t really matter. I would try 5000 and see if that works. You can always change it back. Adobe is working on an official TechNote about this too.

Lee


Fixing Code Hinting in Flash CS5

I’m sure that most people who frequent this blog have already downloaded the Flash CS5 trial and started playing with it. If not, go over to the Adobe site to get it. One of the coolest new features is custom class introspection in the Actions editor. There is one important thing to be aware of though in order to get things running smoothly. In the screenshot below you will notice that a yellow warning sign appeared in the bottom-right of the panel when I tried to use code hinting. This means that Flash found too many files on the classpath and basically it stopped looking for custom ActionScript files.

Ok so what does all this mean? If you set a source folder in your ActionScript settings, you need to be sure that it is not a top-level folder on your system or any other folder that has a large amount of sub-directories in it. When Flash starts traversing that folder it will only go so far before bailing out. The fix? Just make sure that you point Flash to a dedicated directory of source files and also save your FLA file into its own folder rather than just plopping it onto the desktop. If you do get the little yellow warning, you will have to relaunch Flash in order to fix the issue once you move your files to a more appropriate location.

Lee


1 - 5 of 135 Prev 5Next 5