OK so if I want to do strict typing, there is not a way to pass in the
class name I want to cast ObjectA to, then create the "class
template", and then cast it (the template) to ObjectA?


--- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]> wrote:
>
> Type objectA as Object instead of UIComponent.
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Libby
> Sent: Wednesday, December 07, 2005 1:06 PM
> To: [email protected]
> Subject: [flexcoders] Re: Cast Object Name from string then do
> object.function() - is it possible?
> 
>  
> 
> Since Flex' compiler thinks objectA is just a vanilla Object, it
> complains that bar() is an unknown method. That was why i needed to
> cast the real object to ObjectA. So how do I get this to work without
> importing every one of the hundred mxml files that could get passed in?
> 
> 
> --- In [email protected], "JesterXL" <[EMAIL PROTECTED]> wrote:
> >
> > 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
> >
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> 
> 
> 
> 
> SPONSORED LINKS 
> 
> Web site design development
> <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+
> site+design+development&w2=Computer+software+development&w3=Software+des
> ign+and+development&w4=Macromedia+flex&w5=Software+development+best+prac
> tice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>  
> 
> Computer software development
> <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=We
> b+site+design+development&w2=Computer+software+development&w3=Software+d
> esign+and+development&w4=Macromedia+flex&w5=Software+development+best+pr
> actice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>  
> 
> Software design and development
> <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=
> Web+site+design+development&w2=Computer+software+development&w3=Software
> +design+and+development&w4=Macromedia+flex&w5=Software+development+best+
> practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>  
> 
> Macromedia flex
> <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+
> development&w2=Computer+software+development&w3=Software+design+and+deve
> lopment&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=1
> 66&.sig=OO6nPIrz7_EpZI36cYzBjw>  
> 
> Software development best practice
> <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&;
> w1=Web+site+design+development&w2=Computer+software+development&w3=Softw
> are+design+and+development&w4=Macromedia+flex&w5=Software+development+be
> st+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>  
> 
>  
> 
>  
> 
> ________________________________
> 
> YAHOO! GROUPS LINKS 
> 
>  
> 
> *      Visit your group "flexcoders
> <http://groups.yahoo.com/group/flexcoders> " on the web.
>         
> *      To unsubscribe from this group, send an email to:
>        [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> 
>         
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> . 
> 
>  
> 
> ________________________________
>






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