You don't need to cast via a function, you can do that already.  While this 
works:

objectA = ViewStack.getChildAt(0);
objectA.bar();

Since Flex' compiler thinks objectA is just a vanilla Object, thus can't 
imply it's type.  However, if you want strict-typing, you can do:

objectA = object1(ViewStack.getChildAt(0));
objectA.bar();

This assumes object1 is an imported class.


----- Original Message ----- 
From: "Libby" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, December 07, 2005 1:00 PM
Subject: [flexcoders] Cast Object Name from string then do 
object.function() - is it possible?


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







--
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








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/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