Hi,

You are creating a new instance of the MenuDemo.

Instead,

Solution 1:
in the handleclick event.  Generate a custom event and handle the same
in menudemo.mxml

In About.mxml define the cust event as follow
<mx:Metadata>
        [Event(name="userInfoComplete",
type="com.events.MenuDemoevents")]
</mx:Metadata>

In Menudemo.mxml

<views:About userInfoComplete="handleClickEvent(event)/>

In the handleclick event.
vs.selectedIndex  = 2;

Solution 2:
This should work out or the simplest could be

ViewStack(parent).selectedIndex = 2

Pls check it out.

You were creating a new instance of menudemo in your code.
It is like .you have a menudemo within which you have a view stack and
that has a component About and when you click a button you are
creating another menudemo which will become the child of the About
component and will not refer to the old component.

Thanks & Regards
Mukund



On Jul 17, 12:23 pm, Sidhu Vijay Sidhu <[email protected]> wrote:
> Hi guys
>
> I have four different components in views folder and i have a view stack in
> which those components are imported like this
>
> <mx:ViewStack id="vs" resizeToContent="true" selectedIndex="1">
>
> <views:About/>
>
> <views:Restaurant/>
>
> <views:Home />
>
> <views:Contact/>
>
> <views:Events/>
>
>  </mx:ViewStack>
>
> and in About componet i have button i want when i click on that button
> control goes to component called Home...i have tried like this
>
> This is in About
>
> <mx:Button label="GoToHome" click="handleClick(event)"/>
>
> <mx:Script>
>
> <![CDATA[
>
> *import* MenuDemo; // Main Application in view stack is there
>
> *public* *var* menuObj:MenuDemo = *new* MenuDemo();
>
> *public* *function* handleClick(event:MouseEvent):*void*{
>
> menuObj.vs.selectedIndex=2;
>
>  }
>
> ]]>
>
> But it is showing null object ref... How can i do this ..Help me
>
> </mx:Script>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to