Hi cool list.

In the following piece of code, I cannot make the type of the parent reference 
to DisplayObject. If I set the reference-type to *, all works fine. But there 
must be a more sophisticated way that produces cleaner code.

Anyone?

Code:
public class Test extends Sprite
{
            public var o:DisplayObject;
            public var r:DisplayObject; // produces error see below
            // public var r:*; // works like a charm

            public function Test( obj :DisplayObject )
            {
                        r = obj.parent;
                        o = obj;
                        r.addChild(this); // this line produces the error
            }
}

Error:
1061: Call to a possibly undefined method addChild through a reference with 
static type flash.display:DisplayObject.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to