Hopefully the line breaks here wont be too bad, pasting the code:

<CODE>

package {

        import flash.utils.describeType;
        import flash.utils.getQualifiedClassName;
        
        /**
         * @author karim @ kurst.co.uk
         */
        public class ClassUtils {
                
                public static  function getSuperClass( obj : Object ):String {
                        
                        var superClass  : String        = 
describeType(obj)....@base;
                        var isBase              : Boolean       =  ( superClass 
== '' )
                        
                        if ( isBase )
                                return getClassName( obj );
                        else 
                                return replaceChar(superClass, '::', '.')


                    return '';
                }

                public static function getFullClassPath( obj : * ) : String {
                        
                        var className : String = getQualifiedClassName( obj );
                        
                        if ( className != null ){
                                
                                if ( className.indexOf( '::' ) == -1 ){
                                        
                                        return className;
                                        
                                } else {
                                        return replaceChar(className, '::', '.')
                                        
                                        
                                }
                        } else {
                                return '';
                                
                        }
                        
                }
        
        
                public static function getClassName( obj : * ) : String {
                        
                        var className : String = getQualifiedClassName( obj );
                        
                        if ( className != null ){
                                
                                if ( className.indexOf( '::' ) == -1 ){
                                        
                                        return className;
                                        
                                } else {
                                        
                                        return className.substr( 
className.indexOf( '::' ) + 2 , className.length )
                                        
                                }
                        } else {
                                return '';
                                
                        }
                        
                }
        
                
                
                public static function replaceChar( str : String, charToRemove 
: String , charToReplace : String) : String {
                        
                                var temparray:Array = str.split(charToRemove);
                                return temparray.join(charToReplace);   
                        
                }
                
                
        }
}



</CODE>
On 2 Dec 2010, at 03:21, Micky Hulse wrote:

> Hi Karim! Many thanks for the reply and code sample! I really
> appreciate the help. :)
> 
> On Wed, Dec 1, 2010 at 5:19 PM, Karim Beyrouti <ka...@kurst.co.uk> wrote:
>> attached a class that does that, hope it helps...
> 
> Doh! Looks like the Flash Coders List does not allow attachments! :(
> 
> Do you have a server you could upload the AS file to? Maybe you could
> post it on GitHub, or create a Gist? I would love see your class. :)
> 
> <https://gist.github.com/>
> 
> Thanks Karim!
> 
> Cheers,
> Micky
> _______________________________________________
> 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

Reply via email to