weimingtom / nekonme

Automatically exported from code.google.com/p/nekonme
0 stars 0 forks source link

Impossible to override methods of DisplayObjectContainer correctly #203

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Overloading method called if another method called
Typical problem:

override public function addChild(child:DisplayObject):DisplayObject
{
    super.addChild(child);
    _layout.add(child);
    return child;
}

public function addChildAt(child:DisplayObject, index:Int):DisplayObject
{
    super.addChildAt(child, index);
    _layout.add(child);
}

Expected:
1 times calling of _layout.add(child)
Result:
_layout.add(child) called 2 times on addChildAt

What version of the product are you using? On what operating system?
nme 3.2.0, target: windows, OS: Windows XP

Please provide any additional information below.
Code of nme DisplayObjectContainer.hx:

public function addChildAt(child:DisplayObject, index:Int):DisplayObject
{   
    addChild(child);// addChild may be ovveriden! Be better nmeAddChild(child)
    setChildIndex(child, index);// be better nmeChildIndex(child)

    return child;
}

Original issue reported on code.google.com by cse...@gmail.com on 12 Mar 2012 at 4:57

GoogleCodeExporter commented 8 years ago
Resolved (https://haxenme.atlassian.net/browse/NME-22)

Original comment by joshuagr...@gmail.com on 14 Mar 2012 at 2:14