Category Archives: ActionScript

Declaring variable type

During FITC this past weekend, I saw a presenter showing code such as:

var x, y:Number;

This innocent looking line may seem like declaring two variables x & y as the Number data type. However, what it actually does is declaring variable x with an undefined data type, and y as a Number.

To test, try this:

x = "";

Test movie, all is fine. No error message.

Now add this line:

y = "";

Test movie, and you’ll see the error message:

‘Type mismatch in assignment statement: found String where Number is required. y = “”;’

So remember to declare variables as intended, such as:

var x:Number;
var y:Number;

Flash Lite 2.0 Nokia S60 Template

Here is a Flash Lite 2.0 template for the Nokia S60 series. Yesterday‘s release doesn’t seem to include this template.

Place it in the “Configuration\Templates\Global Phones” directory.

For Windows, the default English location is:
C:\Program Files\Macromedia\Flash 8\en\Configuration\Templates\Global Phones

For Mac OS X, put the file here:
/Applications/Macromedia Flash 8/Configuration/Templates/Global Phones/

Download it here: http://quantumwave.com/pub/FL2_S60_Template.zip

When this is installed, you can choose it from Global Phones in the Start Page.