Re: [flexcoders] Re: Polymorphism....?

2008-02-20 Thread Sujit Reddy
You said that you extended UIComponent and included isClosed property in your classes. The problem with the code is that, in your if statement you included ((c is UIComponent).isClosed == true. When the compiler executes c is UIComponent the object you get is Boolean and now it will try to invoke i

[flexcoders] Re: Polymorphism....?

2008-02-20 Thread Ryan Frishberg
Another good option would be to say ICloseable extends IUIComponent b/c IUIComponent is a Flex interface defined for you that has most of what you want. -Ryan --- In flexcoders@yahoogroups.com, "b_alen" <[EMAIL PROTECTED]> wrote: > > I wouldn't suggest you uptype to an IClosable interface. By doi

[flexcoders] Re: Polymorphism....?

2008-02-20 Thread b_alen
I wouldn't suggest you uptype to an IClosable interface. By doing so, you loose access to all the members of the UIComponent. And having access to super class's members is why you do inheritance in the first place. say: class Sub extends UIComponent implements IClosable var sub1:IClosable = new

[flexcoders] Re: Polymorphism....?

2008-02-19 Thread dsds99
Thanks, your solution worked. If I think about it, I'm puzzled. Just like UIComponent, the IClosable interface doesn't have the isClosed property either. So when I cast it that interface, it should fail but it doesn't. If that's how interfaces work. Then casting it as IUIComponent interface shou

[flexcoders] Re: Polymorphism help

2008-01-09 Thread Nathan Arizona
Thank you Brian. I was not thinking properly. Polymorphism was working. That is why I can pass in an event type of LoginEvent. All I have to do is cast it to LoginEvent. ie LoginEvent(event). --- In flexcoders@yahoogroups.com, "Brian Holmes" <[EMAIL PROTECTED]> wrote: > > > > Change your i

[flexcoders] Re: Polymorphism help

2008-01-09 Thread Nathan Arizona
I have already answered my own question. Polymorphism does not work in that direction. All I need to do is pass in the event as type Event, that is where polymorphism works. It treats my custom event as an Event. Then I can cast the Event to a LoginEvent and use the features of my custom event