Hi Ian, Which flash version are you using? I had other problems yesterday with extending CollectionImpl due to my flash version (mx 2004), which worked just fine in flash 8. Might be the same in this case.
Are you using 7 or 8? Thanks! Hans -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: Wednesday, February 01, 2006 1:05 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] interfaces and objects No, you can't instantiate an interface. But I don't think Hans was doing that. There's no problem with typing: interface IWorldPart {} class SomeWorldPartSubclass implements IWorldPart {} var myPart:IWorldPart = new SomeWorldPartSubclass(); /* Note INTERFACE-typed var, not concrete */ myCollection.addItem(myPart); Works fine for me on a quick test. A sanity check of trace(myPart instanceof Object); //traces true shows that you should be able to use the myPart variable everywhere that an Object is expected. Ian On 2/1/06, Julien Vignali <[EMAIL PROTECTED]> wrote: > > Well, you can't instanciate an interface, you need first a concrete > class that implements the interface... > > Your code should be: > > interface IWorldPart {} > class SomeWorldPartSubclass implements IWorldPart {} var > myPart:SomeWorldPartSubclass = new SomeWorldPartSubclass(); > myCollection.addItem(myPart); > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

