First lets explain the problem:
A viewstack normally doesn't create all it's children, but only the
visible ones. This has been done in an ateempt to minimize the
startuptime of your application.

Possible solution:
1. Ask yourself if you really need to write data on something that is
not visible. It's not like someone is going to notice it...
Try if you could use the initialize/show-events of the child itself to
do this.
2. If you can't delegate the writing, and you do have to write to an
invisible component. Do as Josh suggested and set the creationPlicy of
the viewstack and its children to "all". This should let the viewstack
create it's children, even if they're not visible.

--jeetee

--- In [email protected], "Rafael Faria"
<[EMAIL PROTECTED]> wrote:
>
> Hello all,
> 
> I'm having a big trouble with a viewstack.
> 
> I have this code
> 
>       <mx:ViewStack id="vstack" width="800" height="400">
>                       
>                       <mx:Canvas id="step1" label="donor information">
>                               <mx:HBox>
>                                       <mx:Canvas id="step1_1" width="390" />
>                                       <mx:Canvas id="step1_2" width="375" />
>                               </mx:HBox>
>                       </mx:Canvas>
>       
>                       <mx:Canvas id="step2" label="call status">
>                               <mx:HBox>
>                                       <mx:Canvas id="step2_1" width="390" />
>                                       <mx:Canvas id="step2_2" width="375" />
>                               </mx:HBox>
>                       </mx:Canvas>
>       
>                       <mx:Canvas id="step3" label="contribution information">
>                               <mx:HBox>
>                                       <mx:Canvas id="step3_1" width="390" />
>                                       <mx:Canvas id="step3_2" width="375" />
>                               </mx:HBox>
>                       </mx:Canvas>
>                       
>               </mx:ViewStack>
> 
> and an init actionscript which i'm just trying to trace the elements
> to see what happens and ends up getting null for some elements that i
> need to work with.
> 
> private function init():void {
> trace(step1); // return the object
> trace(step1_1); // return the object
> trace(step1_2); // return the object
> trace(step2); // return the object
> trace(step2_1); // return NULL
> trace(step2_2);  // return NULL
> trace(step3) // return the object
> trace(step3_1); // return NULL
> trace(step3_2); // return NULL
> }
> 
> The problem is that i really need to work with the canvas on the
> initialization. I can write dynamically on the canvas (step2 and
> step3) but weirdly i can't get the objects inside them.
> 
> Any guru to help me out with that?! 
> 
> Raf
>


Reply via email to