in AS3 theres this :

getClassByName(name:String) : Class

var classToCast:Class = getClassByName(object1);
objectA = classToCast(ViewStack.getChildAt(0));

i havent tried it, but its something that might work.

in AS2 you might be able to dig the class out of _global

var classToCast = eval("_global."+className);

again, not something i've tried, but i have instantiated objects using 
that form of access :

var obj = new eval("_global." + className)();

so, in theory it should work.

good luck.

martin.

Libby wrote:
> In Flex is there a way to pass an object name into a method and then
> cast that name to another object in order to execute a method on that
> object ?
> 
> 
> foo("myMxmlObjectName");
> 
> function foo(object1:String) {
>      var objectA:UIComponent;
>      objectA = object1(ViewStack.getChildAt(0));
>      objectA.bar();
> } 
> 
> Thanks,
> Libby
> 


-- 
Martin Wood

http://relivethefuture.com/choronzon


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to