New OpenFL Project in FlashDevelop

The tutorial in http://haxecoder.com/post.php?id=14 says that when a new OpenFL project is created in FlashDevelop, the following template is generated in Main.hx:

package ;

import flash.display.Sprite;
import flash.events.Event;
import flash.Lib;

class Main extends Sprite 
{
	var inited:Bool;

	/* ENTRY POINT */
	
	function resize(e) 
	{
		if (!inited) init();
		// else (resize or orientation change)
	}
	
	function init() 
	{
		if (inited) return;
		inited = true;
		
		// code
	}

	/* SETUP */

	public function new() 
	{
		super();	
		addEventListener(Event.ADDED_TO_STAGE, added);
	}

	function added(e) 
	{
		removeEventListener(Event.ADDED_TO_STAGE, added);
		stage.addEventListener(Event.RESIZE, resize);
		#if ios
		haxe.Timer.delay(init, 100); // iOS 6
		#else
		init();
		#end
	}
	
	public static function main() 
	{
		// static entry point
		Lib.current.stage.align = flash.display.StageAlign.TOP_LEFT;
		Lib.current.stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
		Lib.current.addChild(new Main());
		//
	}
}

However, the template generated in my computer is different:

package;

import openfl.display.Sprite;
import openfl.Lib;

/**
 * ...
 * @author abc
 */

class Main extends Sprite 
{

    public function new() 
    {
        super();
        
        // Assets:
        // openfl.Assets.getBitmapData("img/assetname.jpg");
    }
}

Why is that? Perhaps OpenFL was updated after the tutorial? Thanks in advance.

Yes. A few days ago I made similar topic…

1 Like

The thread is:

http://community.openfl.org/t/new-main-class-template-issue/908

1 Like