Hi there,

I have this really simple problem. I have created a ViewStack within my main
application. I would like to switch into different views from a custom
component that I have. Here's my code:

<mx:ViewStack id="mainStack" borderStyle="solid" width="100%" height="100%">
       <mx:Canvas id="startPage" width="100%" height="100%">
                <mx:Label text="Welcome!"/>
             </mx:Canvas>
             <mx:Canvas id="addCustomer" width="100%" height="100%">
                 <comp:addCustomer />
             </mx:Canvas>
</mx:ViewStack>


and within my 'addCustomer' custom component, I have a method:

public function test():void {
                    mainStack.selectedChild=mainPage;
            }


when I call method test() I am getting the following errors:

1120: Access of undefined property mainPage.
1120: Access of undefined property mainStack.

I understand that this is because the mainStack has been defined in the
starting page. So, how can I access this stack inside a component?

thanks !

George

Reply via email to