I was able to compile this with the flex 4 compiler with only a warning about createdFunction being untyped (why wouldn't you give it a type?). Typing it as * or Function results in exactly what you would expect.
Code:
package
{
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author srs
*/
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
var createdFunction:Function = function():void {
trace("Function Created");
}
createdFunction();
}
}
}