Thank you Geoffrey! I could have SWORN that I tried this method of using the Brackets - similar to using "Eval" which has been deprecated I think. I used that in my Flash Apps quite often.
Actually, I did use the Brackets once before (still with no success) - but I left out the "this" portion inside of the Container Constructor. Still, I would have thought that it would have grabbed the Variable as it was local to the .mxml file. Still, something must be different now, because it does work - I will try it now once again, and see if I can reproduce the problem - Either way, you have helped me out - and I appreciate that :) Thanks, Mike -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey Williams Sent: Thursday, August 10, 2006 4:15 PM To: [email protected] Subject: [flexcoders] Re: Problems converting String to Container [EMAIL PROTECTED] is an instance name? selectedContainer = Container ([EMAIL PROTECTED]); --- In [email protected], "Mike Anderson" <[EMAIL PROTECTED]> wrote: > > Hello All, > > I have a Tree Control, populated with Name/Value pairs. Each item in > the Tree List relates to a corresponding Custom Component inside of a > ViewStack. I am simply using the Tree Control, to display the > corresponding application state. > > Now, what I am trying to do, is take the @data value from the Tree's > selected item, and pass that value to the ViewStack's selectedChild > property (and properly Casting it along the way). > > For the life of me, I can't get this to work. > > Here is some sample code: > > private var selectedNode:Object; > private var selectedContainer:Container; > > private function menuTree_onChange( event:Event ):void { > selectedNode = Tree(event.target).selectedItem; > > if ([EMAIL PROTECTED] != null) > { > selectedContainer = [EMAIL PROTECTED] as Container; > mainApplicationViewStack.selectedChild = selectedContainer; > } > } > > Unfortunately, I keep getting "Type Coercion failed:" messages. I > verified that all my String Values contained within the Tree Control are > correct, and that the Values actually evaluate to valid Controls > contained within the ViewStack Control. > > As far as I can tell, I am casting the Variables correctly, etc. But I > am obviously doing something terribly wrong here... > > Could any of you let me know what I am doing wrong?? > > Thanks in advance, > > Mike > -- 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 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/

