Thursday, April 7, 2011

ColdFusion - Var Scoping.

A couple of days ago I was making a little program to recursively list files in sub-directories.
In doing so I ran into a good example of why var scoping is so important.

File structure:

Non var scoped code:


Non var scoped results:


However when I properly var scoped the variables. 

var scoped code:


var scoped results:


In simple terms, when the function is being run the second time, ColdFusion is being lazy. Instead of making and declaring a new variable it is using the old one. Adding var scoping will make sure that whenever the function is run the variables are scoped to that instance of the function.

Flash Builder - Debug launches wrong page.

Does your flash builder debug launch using the wrong page?
Do you get weird errors like 'Error #2152: Full screen mode is not allowed.'?

Well perhaps it is launching the wrong page! You can check and change this setting very simply.
1. Right click on your project folder and click 'Properties'.
2. Click 'Run/Debug Settings'.
3. Select the 'Launch configuration' for the application in question and click edit.

What we are looking for is 'URL or path to launch'.
This will most likely be set as 'Use default' but if you uncheck the box it you can change it to what you want.


At work we use ColdFusion and want to hit a .cfm file to start the application instead of the normal .html file.