Please hava a look at this code:
public class Obj extends Sprite
{
public var _clip:Sprite;
public function Obj(clip:Sprite=null)
{
this._clip = clip;
}
public function attachTo(scope:DisplayObjectContainer)
{
if (this._clip)
{
scope.addChild(this); // nothing is displayed
// or scope.addChild(this._clip);
}
}
}
Now i use
var obj = new Obj(new mc());
obj.attachTo(this.container_mc);
whereas the mc() is some library instance.
Naively i would have expected that if the _clip is a member of the Obj Class i would see it on stage when using scope.addChild(this).
But this is not the case.
I have to add the clip directly by using scope.addChild(this._clip) to see it being displayed. Why is that ??
Keith