[flexcoders] Re: flex 4 - NavigatorContent question / element parent
Thanks for the info. I won't need an example as your explanation has given me an insight. Very useful. --- In flexcoders@yahoogroups.com, Netaman rtigr...@... wrote: I use viewStack.removeAllChildren(); also, what I do with the NavigatorContent, is everytime I create a new NavigatorContent container I load the resulting child UI component object into an arrayCollection then when I need to get to the object inside the NavigatorContent I use the viewStack.selectedIndex as an index to the ArrayCollection to manipulate the object, or generate a popup, etc... public function setNavContent(navLabel:String, newView:*):void { var itemNav:NavigatorContent = new NavigatorContent(); itemNav.label = navLabel; itemNav.addEventListener(MouseEvent.DOUBLE_CLICK, circleD.editForms); itemNav.doubleClickEnabled = true; itemNav.minHeight = 300; itemNav.minWidth = 400; itemNav.addElement(newView); circleD.peViewStack.addChild(itemNav); } Where navLabel is a tab string and newView is a UI component usually a composite component If you need a whitewashed code example let me know. Randy --- In flexcoders@yahoogroups.com, bhaq1972 mbhaque@ wrote: myPanel.owner is the same as myPanel.parent so that won't work. Making it a property would work. What would the disadvantages be with using myPanel.parent.parent.parent (a trace shows this to be the navigatorcontent)? I wonder why there is no such property like 'elementParent' to go with addElement() analagous to 'parent' and addChild()? one follow up question - I'm now adding the NavigatorContent to a viewstack. When i do viewstack.removeChild(nc), how do i make sure nc (naviagtorcontent) is destroyed? thanks --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Or make nc a property of the class so you can use it in any method. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Try myPanel.owner On 6/9/10 8:23 AM, bhaq1972 mbhaque@ wrote: I added a Panel component into a NavigatorContent public function aMethod():void { var nc:NavigatorContent = new NavigatorContent(); nc.addElement(myPanel); } Now, in another method I want to access this NavigatorContent eg public function anotherMethod(myPanel:Panel):void { var nc:NavigatorContent = myPanel.parent as NavigatorContent; however nc is not myPanel.parent. doing a trace, the navigatorContent is actually the myPanel.parent.parent.parent Is there not a property/method which gets me a reference to the element Parent (a bit like addChild() / parent relationship) -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: flex 4 - NavigatorContent question / element parent
thanks --- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: nc = null; --- In flexcoders@yahoogroups.com, bhaq1972 mbhaque@ wrote: myPanel.owner is the same as myPanel.parent so that won't work. Making it a property would work. What would the disadvantages be with using myPanel.parent.parent.parent (a trace shows this to be the navigatorcontent)? I wonder why there is no such property like 'elementParent' to go with addElement() analagous to 'parent' and addChild()? one follow up question - I'm now adding the NavigatorContent to a viewstack. When i do viewstack.removeChild(nc), how do i make sure nc (naviagtorcontent) is destroyed? thanks --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Or make nc a property of the class so you can use it in any method. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Try myPanel.owner On 6/9/10 8:23 AM, bhaq1972 mbhaque@ wrote: I added a Panel component into a NavigatorContent public function aMethod():void { var nc:NavigatorContent = new NavigatorContent(); nc.addElement(myPanel); } Now, in another method I want to access this NavigatorContent eg public function anotherMethod(myPanel:Panel):void { var nc:NavigatorContent = myPanel.parent as NavigatorContent; however nc is not myPanel.parent. doing a trace, the navigatorContent is actually the myPanel.parent.parent.parent Is there not a property/method which gets me a reference to the element Parent (a bit like addChild() / parent relationship) -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: flex 4 - NavigatorContent question / element parent
I use viewStack.removeAllChildren(); also, what I do with the NavigatorContent, is everytime I create a new NavigatorContent container I load the resulting child UI component object into an arrayCollection then when I need to get to the object inside the NavigatorContent I use the viewStack.selectedIndex as an index to the ArrayCollection to manipulate the object, or generate a popup, etc... public function setNavContent(navLabel:String, newView:*):void { var itemNav:NavigatorContent = new NavigatorContent(); itemNav.label = navLabel; itemNav.addEventListener(MouseEvent.DOUBLE_CLICK, circleD.editForms); itemNav.doubleClickEnabled = true; itemNav.minHeight = 300; itemNav.minWidth = 400; itemNav.addElement(newView); circleD.peViewStack.addChild(itemNav); } Where navLabel is a tab string and newView is a UI component usually a composite component If you need a whitewashed code example let me know. Randy --- In flexcoders@yahoogroups.com, bhaq1972 mbha...@... wrote: myPanel.owner is the same as myPanel.parent so that won't work. Making it a property would work. What would the disadvantages be with using myPanel.parent.parent.parent (a trace shows this to be the navigatorcontent)? I wonder why there is no such property like 'elementParent' to go with addElement() analagous to 'parent' and addChild()? one follow up question - I'm now adding the NavigatorContent to a viewstack. When i do viewstack.removeChild(nc), how do i make sure nc (naviagtorcontent) is destroyed? thanks --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Or make nc a property of the class so you can use it in any method. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Try myPanel.owner On 6/9/10 8:23 AM, bhaq1972 mbhaque@ wrote: I added a Panel component into a NavigatorContent public function aMethod():void { var nc:NavigatorContent = new NavigatorContent(); nc.addElement(myPanel); } Now, in another method I want to access this NavigatorContent eg public function anotherMethod(myPanel:Panel):void { var nc:NavigatorContent = myPanel.parent as NavigatorContent; however nc is not myPanel.parent. doing a trace, the navigatorContent is actually the myPanel.parent.parent.parent Is there not a property/method which gets me a reference to the element Parent (a bit like addChild() / parent relationship) -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: flex 4 - NavigatorContent question / element parent
nc = null; --- In flexcoders@yahoogroups.com, bhaq1972 mbha...@... wrote: myPanel.owner is the same as myPanel.parent so that won't work. Making it a property would work. What would the disadvantages be with using myPanel.parent.parent.parent (a trace shows this to be the navigatorcontent)? I wonder why there is no such property like 'elementParent' to go with addElement() analagous to 'parent' and addChild()? one follow up question - I'm now adding the NavigatorContent to a viewstack. When i do viewstack.removeChild(nc), how do i make sure nc (naviagtorcontent) is destroyed? thanks --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Or make nc a property of the class so you can use it in any method. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Try myPanel.owner On 6/9/10 8:23 AM, bhaq1972 mbhaque@ wrote: I added a Panel component into a NavigatorContent public function aMethod():void { var nc:NavigatorContent = new NavigatorContent(); nc.addElement(myPanel); } Now, in another method I want to access this NavigatorContent eg public function anotherMethod(myPanel:Panel):void { var nc:NavigatorContent = myPanel.parent as NavigatorContent; however nc is not myPanel.parent. doing a trace, the navigatorContent is actually the myPanel.parent.parent.parent Is there not a property/method which gets me a reference to the element Parent (a bit like addChild() / parent relationship) -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: flex 4 - NavigatorContent question / element parent
myPanel.owner is the same as myPanel.parent so that won't work. Making it a property would work. What would the disadvantages be with using myPanel.parent.parent.parent (a trace shows this to be the navigatorcontent)? I wonder why there is no such property like 'elementParent' to go with addElement() analagous to 'parent' and addChild()? one follow up question - I'm now adding the NavigatorContent to a viewstack. When i do viewstack.removeChild(nc), how do i make sure nc (naviagtorcontent) is destroyed? thanks --- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: Or make nc a property of the class so you can use it in any method. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Try myPanel.owner On 6/9/10 8:23 AM, bhaq1972 mbhaque@ wrote: I added a Panel component into a NavigatorContent public function aMethod():void { var nc:NavigatorContent = new NavigatorContent(); nc.addElement(myPanel); } Now, in another method I want to access this NavigatorContent eg public function anotherMethod(myPanel:Panel):void { var nc:NavigatorContent = myPanel.parent as NavigatorContent; however nc is not myPanel.parent. doing a trace, the navigatorContent is actually the myPanel.parent.parent.parent Is there not a property/method which gets me a reference to the element Parent (a bit like addChild() / parent relationship) -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: flex 4 - NavigatorContent question / element parent
Or make nc a property of the class so you can use it in any method. --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: Try myPanel.owner On 6/9/10 8:23 AM, bhaq1972 mbha...@... wrote: I added a Panel component into a NavigatorContent public function aMethod():void { var nc:NavigatorContent = new NavigatorContent(); nc.addElement(myPanel); } Now, in another method I want to access this NavigatorContent eg public function anotherMethod(myPanel:Panel):void { var nc:NavigatorContent = myPanel.parent as NavigatorContent; however nc is not myPanel.parent. doing a trace, the navigatorContent is actually the myPanel.parent.parent.parent Is there not a property/method which gets me a reference to the element Parent (a bit like addChild() / parent relationship) -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui