Sorry if this has been posted before - I couldn’t find it.
I’ve been trying to catch all instances added to the display list, but have come across this problem when targeting HTML5 (tested and works fine for flash and windows).
stage.addEventListener(Event.ADDED, handleAdded);
function added(event:Event):Void
{
trace(event.target); // Stage (in flash and windows its the object being added as expected).
trace(event.currentTarget); // Stage (as expected)
}
Any thoughts and or workarounds would be much appreciated.
Hello, bug still persists and I need fast fix!!! Probably its new bug.
here is how to reproduce:
It looks like events don’t shoot if I add to stage Element(extended by Sprite) , which already contains elements inside
Switch addChild and f.addChill lines to see difference
class Main extends Sprite
{
public function new()
{
super();
var s = new Element();
var f:Sprite = new Sprite();
addChild(f);
f.addChild(s); // try switching with line above
}
}
class Element extends Sprite
{
public function new()
{
super();
this.addEventListener(Event.ADDED_TO_STAGE, init);
}
function init(?e:Dynamic)
{
this.graphics.beginFill(0x2E4AAB);
this.graphics.drawRect(0, 0, 250, 150);
}
}