I am just getting started with Haxe/OpenFL having come from a C++ background with no Flash experience.
In the tutorial http://www.openfl.org/learn/tutorials/adding-animation/ I encountered issues when following the code as written in regards to the usage of a container sprite.
The code supplied is:
var bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
bitmap.x = - bitmap.width / 2;
bitmap.y = - bitmap.height / 2;
bitmap.smoothing = true;
var container = new Sprite ();
addChild (bitmap);
container.alpha = 0;
container.scaleX = 0;
container.scaleY = 0;
addChild (container);
Actuate.tween (bitmap, 3, { alpha: 1 });
Actuate.tween (bitmap, 6, { scaleX: 1, scaleY: 1 }).ease (Elastic.easeOut);
But this resulted in nothing showing up on screen.
I had to change the code as follows in order to get expected results:
var bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
bitmap.x = - bitmap.width / 2;
bitmap.y = - bitmap.height / 2;
bitmap.smoothing = true;
var container = new Sprite ();
container.addChild (bitmap); //Adding bitmap to container instead of to Main.
container.alpha = 0;
container.scaleX = 0;
container.scaleY = 0;
addChild (container);
Actuate.tween (container, 3, { alpha: 1 }); //Tweening container instead of bitmap
Actuate.tween (container, 6, { scaleX: 1, scaleY: 1 }).ease (Elastic.easeOut); //Tweening container instead of bitmap