You are getting null exception because at that time only first component
will be in visible stage.
if you want to access second component try to access that when that
corresponding object is in visible stage.
Hope following code will clear your doubt
<mx:Viewstack selectedIndex="{selIndex}">
<mx:Comp id="comp1'/>
<mx:Comp1 id="comp2'/>
<mx:Comp1 id="comp3/>
<mx:Comp1 id="comp4'/>
--
---
--
</mx:viewstack>
<mx:Script>
-------
private function func():void{
if(selIndex = =0)
comp1. ___________;
else if(selIndex = =1)
comp2. ___________;
}
</mx:Script>
*Gnanz.../*
Madan Narra wrote:
> Hi All,
>
> Any ideas how could we do this ?
>
> Thanks,
> Madan n
>
> On Wed, Sep 24, 2008 at 12:10 AM, Madan Narra
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
> Hi All,
>
> I have a similar case where in am passing a bean to multiple
> components at a time.
>
> These components are placed in a ViewStack, and all these
> componnets take up a
> [Bindable] bean object individually.
>
> In the initial load, on creationComplete of each component, i am
> checking for if bean is available or not. If available, am
> processing the bean data accordingly in individual components.
>
> But if at all i pass over a bean with modified data, i need to
> sent an notification that bean value is changed, so i could call
> the method which would process the bean data accordingly.
>
> I tried providing IDs to all the components in the view stack, so
> that i could call a method in them which would perform the operation.
>
> The first component in the view stack is working fine. But when
> the same is applied to the second componet, am getting a null
> exception, saying operation is being done on null type.
>
> The components are created and there objects are available. How
> come when i try to get the component and access its method would
> throw an null exeption ?
>
> Anyways, could any one of you explain, is there any other
> alternative to notify individual component , when the bean that is
> being passed to it is changed from the previous one.
>
> Thanks,
> Madan N
>
>
>
>
>
> --
> Thanks,
> Madan N
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---