Um... not quite sure what you're up to here - but it sounds like you're
getting a bit confused between IWorldPart and WorldPart.
What you need is:
interface IWorldPart
class SomeWorldPartSubclass implements IWorldPart
then
var myPart:IWorldPart = new SomeWorldPartSubclass();
should be fine.
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();
Well, you can't instanciate an interface, you need first a concrete
class that implements the interface...
While you cannot instantiate an interface, you can assign an object
that is an instance of a class that does implement the interface to a
variable that is typed to the interface.
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 */
SomeWorldPartSubclass();) by the way.
Thanks for your comments,
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: Wednesday, February 01, 2006 12:36 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] interfaces and objects
Um... not quite
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Julien
Vignali
Sent: Wednesday, February 01, 2006 12:49 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] interfaces and objects
Well, you can't instanciate an interface, you need first
Then as Steve says, sounds like a compiler bug.
Ian
On 2/1/06, j.c.wichman [EMAIL PROTECTED] wrote:
Hi,
No confusion here ;) except maybe for my fuzzy explanation ;).
I did:
interface IWorldPart
class WorldPart implements IWorldPart
class SomeWorldPartSubclass extends WorldPart
then
]
[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
But it should. :-)
Like I said, my quick test of
var myPart:SomeInterface=new SomeConcreteImplementingSomeInterface();
trace(myPart instanceof Object);
Traces 'true'. Which is what I'd expect.
I really don't understand why you're getting an error with myCollection.
I know you've solved your
is not regarded by flash then
of being of type Object as well.
Got it figured out now ;)
Thanks
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Julien
Vignali
Sent: Wednesday, February 01, 2006 12:49 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders
mailing list
Subject: Re: [Flashcoders] interfaces and objects
But it should. :-)
Like I said, my quick test of
var myPart:SomeInterface=new SomeConcreteImplementingSomeInterface();
trace(myPart instanceof Object);
Traces 'true'. Which is what I'd expect.
I really don't understand why you're getting
Hi,
Yes steve was completely right about that.
Thanks all!
H
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: Wednesday, February 01, 2006 1:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] interfaces and objects
MX2004
Cheers,
Ian
On 2/1/06, j.c.wichman [EMAIL PROTECTED] wrote:
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
'Fraid not. One to chalk down to experience, I guess. Oh well. I'm making
the move to 8 shortly myself, once this latest crop of projects are out of
the way...
Ian
On 2/1/06, j.c.wichman [EMAIL PROTECTED] wrote:
Life is so unfair :)
I had to switch to flash 8 to make it go away... My mind
14 matches
Mail list logo