flashcoders  

Re: [Flashcoders] The issue of "parent" in AS3

Sy Iridium
Thu, 15 May 2008 02:19:53 -0700

Hi,
don't know if my way is "cleaner" but it is certainly more general because
if you change the parent class you don't need to "find and replace" all
type-casting of the previous class with new class. My solution to this is to
type-cast the parent class to Object class. It is dynamic class so you can
use any methods you have added to your class without restrictions. Hope it
helps.

2008/5/15 Johan Nyberg <[EMAIL PROTECTED]>:

> Anybody knows if it's bad practice to type-cast the parent-property to the
> class of the parent?
>
> Since parent is a property of the DisplayObject class, you can only
> reference properties and methods of that class directly through the
> parent-property.
>
> If you want to access other properties or methods, you have to type-cast
> parent to the specific class.
>
> If you have some other "cleaner" ways of doing this it would be greatly
> appreciated!
>
> Regards,
>
> Johan Nyberg
> Designer and web developer
>
> [EMAIL PROTECTED]
> 08 - 50 00 24 30
> 070 - 407 83 00
>
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders