[Flashcoders] Interfaces and private methods ...

2008-08-04 Thread S0 F1
How can you force a set of classes to define a private method if Interface members cannot be declared public, private, protected, or internal? Create an abstract class with private method(s) that throw an error, unless overwritten by subclasses? Is this the only way?

Re: [Flashcoders] Interfaces and private methods ...

2008-08-04 Thread Cédric Tabin
Hello, You cannot force a class to implement a private method. And that would be totally useless... The target of an interface is to define a set of methods that are accessible by any classes = private, internal and protected methods are too restricted. What do you want to do ? Regards, Cedric

Re: [Flashcoders] Interfaces and private methods ...

2008-08-04 Thread Ian Thomas
On Mon, Aug 4, 2008 at 9:37 AM, Ian Thomas [EMAIL PROTECTED] wrote: Why would you want to force implementation of a private class? Private method. Sorry! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com

Re: [Flashcoders] Interfaces and private methods ...

2008-08-04 Thread Ian Thomas
Why would you want to force implementation of a private class? Or are you actually trying to create an abstract class - and are trying to ensure that a subclass provides an implementation of an internal method? (Labelled as 'private' in AS2 or 'protected' in AS3.) In which case, neither AS2 nor

Re: [Flashcoders] Interfaces

2008-04-02 Thread Omar Fouad
@chattyfig.figleaf.com Sent: Wednesday, April 02, 2008 1:58 AM Subject: Re: [Flashcoders] Interfaces Well, the example in the blog explained it a lot, though it is in Actionscript 2.0. And yes, I wont need Interfaces unless I really feel like I HAVE to use them. In my project I have some Panels

[Flashcoders] Interfaces

2008-04-01 Thread Omar Fouad
list, I've been reading tons of books and I still can't get the concept of Interfaces. Can someone explain it with an easy example for me? Help will be really appreciated. -- Omar M. Fouad - Digital Emotions http://www.omarfouad.net This e-mail and any attachment is for authorised use by the

RE: [Flashcoders] Interfaces

2008-04-01 Thread Merrill, Jason
I've been reading tons of books and I still can't get the concept of Interfaces. It's actually very very simple. An interface is just a special class that sets the rules of other classes. So an interface doesn't do anything in your application, it just helps the coder(s) to make sure they

Re: [Flashcoders] Interfaces

2008-04-01 Thread Omar Fouad
Yeah, but I've read that a Class that implements an interface an call function from other classes that allready extends other Classes. it's like a multiple inheritance. But how can I achieve it? On Tue, Apr 1, 2008 at 10:30 PM, Merrill, Jason [EMAIL PROTECTED] wrote: I've been reading tons of

RE: [Flashcoders] Interfaces

2008-04-01 Thread Merrill, Jason
Yeah, but I've read that a Class that implements an interface an call function from other classes that allready extends other Classes. it's like a multiple inheritance. But how can I achieve it? I don't quite follow what the issue is, but don't confuse inheritance with implements. Do you mean:

Re: [Flashcoders] Interfaces

2008-04-01 Thread EECOLOR
An interface is used to make sure your code is not tightly coupled. Instead of saying which class should be given, you say which interface should be given. This means that a developer has more freedom to implement his own version of an interface. Lets say you make a person interface called

Re: [Flashcoders] Interfaces

2008-04-01 Thread Steven Sacks
Interfaces can do much more than just help multiple coders stay on track. In Actionscript 3, they can be used to mimic multiple inheritance, decrease file size of loaded swfs, and clarify your own code. Interfaces are simple, but understanding Interfaces and how and when to use them takes a

Re: [Flashcoders] Interfaces

2008-04-01 Thread robert
On Apr 1, 2008, at 1:19 PM, Omar Fouad wrote: list, I've been reading tons of books and I still can't get the concept of Interfaces. Can someone explain it with an easy example for me? Help will be really appreciated. This guy's example gave me a good foothold. Maybe it will help:

Re: [Flashcoders] Interfaces

2008-04-01 Thread Muzak
If you're the only person working on a project, interfaces can be less useful unless you know how to use them well. Putting them in just to put them in serves no purpose other than bloating your code. But, sometimes you need to do that in order to figure them out. I'd even go as far as

Re: [Flashcoders] Interfaces

2008-04-01 Thread Omar Fouad
Well, the example in the blog explained it a lot, though it is in Actionscript 2.0. And yes, I wont need Interfaces unless I really feel like I HAVE to use them. In my project I have some Panels (screens) in the fla Library and each one of them is linked to a Class (linkage). Each class or Panel

Re: [Flashcoders] Interfaces

2008-04-01 Thread Muzak
flashcoders@chattyfig.figleaf.com Sent: Wednesday, April 02, 2008 1:58 AM Subject: Re: [Flashcoders] Interfaces Well, the example in the blog explained it a lot, though it is in Actionscript 2.0. And yes, I wont need Interfaces unless I really feel like I HAVE to use them. In my project I have

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-16 Thread Ray Chuan
Hi Ian, an intrinsic is not used only for built-in Flash Player classes/code. You can use it to save yourself some time, since the compiler doesn't compiler the bytecode all again. With intrinsics no bytecode is generated, only type-checking is done. With interfaces bytecode is generated. I'm

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-16 Thread Ian Thomas
Hi Ray, I know what intrinsics are, what they're _supposed_ to be for, and what they're actually used for. :-) It's a matter of personal preference. I don't use them because, as I said earlier, I can do things in other ways. For the purpose I was talking about - seperating code into different

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-14 Thread Ray Chuan
Hi, can't this be done with intrinsics? http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Partsfile=1879.html On 10/14/06, Ian Thomas [EMAIL PROTECTED] wrote: On 10/13/06, Jim Kremens [EMAIL PROTECTED] wrote: I understand what interfaces

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-14 Thread slangeberg
can't this be done with intrinsics? Ray, an interface does not include variables, so this example looks more like an Abstract class. intrinsic class Circle { var radius:Number; function Circle(radius:Number); function getArea():Number; function getDiameter():Number; function

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-14 Thread Ian Thomas
Hi Ray, Yes - but why would you, if the language spec already supports interfaces? Using interfaces is a much more 'standard' way (i.e. the same sort of thing you'd do if you were talking to dynamic libraries in other languages). I still see intrinsics as a bit of a hack. These classes are

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-14 Thread Ian Thomas
Scott, To me, an abstract class is one which has a partial - but incomplete - implementation i.e. you should never find yourself writing new SomeAbstractClass() - you should only ever be creating objects derived from it. The abstract class contains some useful re-usable stuff, but can't function

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-14 Thread slangeberg
Ian, That being the case, I can't quite see how intrinsics apply, as by their nature they include no implementation at all. Ah, good point. I just got excited when I saw that variable in there. It is one step closer to abstract. Oddly, in AS3 Macrodobe have taken out the facility to mark

[Flashcoders] Interfaces: what are the advantages?

2006-10-13 Thread Mendelsohn, Michael
Hi list... I understand what interfaces are, but I'm not entirely clear on when they become advantageous to use. Anyone care to shed some light? Thanks, - Michael M. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-13 Thread slangeberg
Design principle: 'Code to interface, not implementation'. Say you have classic MusicPlayer interface (and this is all psuedo-code): play() stop() ok, now I've got CDPlayer implements MusicPlayer: play() stop() == nextTrack() and TapePlayer implements MusicPlayer: play() stop() ==

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-13 Thread Andreas R
Mendelsohn, Michael wrote: Hi list... I understand what interfaces are, but I'm not entirely clear on when they become advantageous to use. Anyone care to shed some light? Thanks, - Michael M. ___ Flashcoders@chattyfig.figleaf.com To change your

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-13 Thread Jim Kremens
I understand what interfaces are, but I'm not entirely clear on when they become advantageous to use. Anyone care to shed some light? I find them really useful for implementing the strategy pattern, and I find the strategy pattern to be extremely useful in Flash. Let's say, for example, that

Re: [Flashcoders] Interfaces: what are the advantages?

2006-10-13 Thread Ian Thomas
On 10/13/06, Jim Kremens [EMAIL PROTECTED] wrote: I understand what interfaces are, but I'm not entirely clear on when they become advantageous to use. Anyone care to shed some light? Interfaces are also very handy when you want to put the actual implementation code for a class in one .swf,

[Flashcoders] interfaces and objects

2006-02-01 Thread j.c.wichman
Hi, i'm using a collection, which requires items of type Object to be added. I've declared an interface which gives me something like: - interface IWorldPart - a class implementing WorldPart now somewhere else i do: var myPart:IWorldPart = new SomeWorldPartSubclass(); myCollection.addItem

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Ian Thomas
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.

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Julien Vignali
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();

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Steve Webster
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.

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Ian Thomas
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 */

RE: [Flashcoders] interfaces and objects

2006-02-01 Thread j.c.wichman
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

RE: [Flashcoders] interfaces and objects

2006-02-01 Thread j.c.wichman
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

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Ian Thomas
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

RE: [Flashcoders] interfaces and objects

2006-02-01 Thread j.c.wichman
] [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

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Ian Thomas
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

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Julien Vignali
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

RE: [Flashcoders] interfaces and objects

2006-02-01 Thread j.c.wichman
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

RE: [Flashcoders] interfaces and objects

2006-02-01 Thread j.c.wichman
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

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Ian Thomas
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

Re: [Flashcoders] interfaces and objects

2006-02-01 Thread Ian Thomas
'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