Many thanks for the replies, describeType works great.

I can't get c.Roadnight to work though and for now am having to create an
instance of the class to call the function (which I had to make non-static).

            var selectedTemplateClass:Class = initEvent.frameType;
            var xml:XML = selectedTemplateClass.getBlankXML();

gives a compiler error.

            var selectedTemplateClass:Class = initEvent.frameType;
            var xml:XML = selectedTemplateClass.getBlankXML;

does not give a compiler error but xml remains null

I also tried

            var selectedTemplateClass:Class = initEvent.frameType;
            var blankXMLFunction:Function =
selectedTemplateClass.getBlankXML;
            var xml:XML = blankXMLFunction();

but blankXMLFunction remains null.

At the moment I have it working with a fresh instance of the class but I'd
rather not do it this way if possible.

Thanks

Giles

On Tue, May 13, 2008 at 6:32 PM, Alex Harui <[EMAIL PROTECTED]> wrote:

>    You mean you have:
>
>
>
> pulbic class Giles
>
> {
>
>             public static function Roadnight():void
>
>             {
>
>             }
>
> }
>
>
>
> And
>
>
>
> var c:Class = Giles;
>
>
>
>
>
> If so it is just just be c.Roadnight or c["RoadNight"]
>
>
>  ------------------------------
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Giles Roadnight
> *Sent:* Tuesday, May 13, 2008 8:44 AM
> *To:* flexcoders@yahoogroups.com
> *Subject:* [flexcoders] Re: Calling static function on Class instance
>
>
>
> Along the same lines - how do I get the class name from a Class object. If
> I do toString() I get [class HeaderImage1]. Do I just have to extract the
> string from that?
>
> Thanks again
>
> Giles
>
> On Tue, May 13, 2008 at 4:21 PM, Giles Roadnight <[EMAIL PROTECTED]>
> wrote:
>
> Hi All
>
> I have a class (BaseTemplate) that is extended to become lots of different
> Template classes.
>
> I have a list class that takes an array of Class objects to allow a user
> to select a template (the renderer creates an instance of the class).
>
> When I click an item in the list I want to call a static function on the
> Template.
>
> When I have a Class object is there anyway of calling a static function on
> that class without creating an instance of the class?
>
> Thanks
>
> --
> Giles Roadnight
> http://giles.roadnight.name
>
>
>
>
> --
> Giles Roadnight
> http://giles.roadnight.name
>   
>



-- 
Giles Roadnight
http://giles.roadnight.name

Reply via email to