This is a great explanation and makes sense. Thank you. I implemented 
the idea in my app; however, the text value in the somechild2 is not 
populating. What do I need to set "text" as in the second child? I 
tried setting it to "", I tried leaving it out, but it won't set when 
I run the app.

Also, if I want to set a variable in the parentDocument based on this 
text value, can I call a setVariable function from the child? The 
script in child1 would like to access a function in the 
parentDocument. Can I call it this way? 

parentDocument.setVariable()

Thanks

--- In [email protected], Gordon Smith <[EMAIL PROTECTED]> wrote:
> Certainly. From any script in a Flex application, you can access 
data from
> any component and store it anywhere. You can use "relative" 
or "absolute"
> access, as in any hierarchy.
> 
> From a script of the parent document, you can access properties of
> descendant components by "dotting down" relative to the parent, 
using the
> ids of the descendants:
> 
> someChild1.someTextInput.text = someChild2.someTextInput.text;
> 
> This is analogous to a relative path:
> 
> cd a\b
> 
> In a script of the first child you would do
> 
> parentDocument.someChild2.someTextInput.text = 
someTextInput.text;
> 
> because these expressions are evaluated with 'this' being 
someChild1.
> 
> This is analogous to a relative path which "goes up a level":
> 
> cd ..\a\b
> 
> When you write a <Script> in a component, think of that component 
as like
> the "current directory". You can go down or up the hierarchy of 
nested
> components from there.
> 
> Note that I said nested components, not nested containers. Flex 
does NOT
> make you dot down through every container inside a component. That 
would
> make your scripts break every time introduced another container to 
affect
> the layout.
> 
> By "absolute" access I mean dotting down from the top of the 
hierarchy,
> which is the Application object. In any script you could do
> 
> 
Application.application.someParent.someChild1.someTextInput.text =
> 
Application.application.someParent.someChild2.someTextInput.text;
> 
> This is analogous to
> 
> cd c:\a\b
> 
> I will save explaining the difference between writing
> 
> Application.application
> 
> and just
> 
> application
> 
> for another day. (Hint: They can be different when you have an app 
which
> loads another app.)
> 
> - Gordon
> 
> 
> -----Original Message-----
> From: kredding.geo [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 02, 2005 6:40 PM
> To: [email protected]
> Subject: [flexcoders] Re: ViewStack change using separate mxml file
> 
> 
> 
> 
> Now I have a parent document with 2 children mxml docs using 
> viewStack. I would like to take the value of a textInput from one 
> child and place that value into a text control of the second 
child. 
> Is this possible?
> 
> Thank you
> 
> --- In [email protected], "kredding.geo" 
<[EMAIL PROTECTED]> 
> wrote:
> > 
> > Perfect. Thank you.
> > 
> > 
> > --- In [email protected], Gordon Smith <[EMAIL PROTECTED]> 
wrote:
> > > Try
> > > 
> > > parentDocument.headerStack.selectedChild = secondCanvas;
> > > 
> > > - Gordon
> > > 
> > > -----Original Message-----
> > > From: kredding.geo [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, March 02, 2005 5:13 PM
> > > To: [email protected]
> > > Subject: [flexcoders] ViewStack change using separate mxml file
> > > 
> > > 
> > > 
> > > 
> > > I created a simple mxml applicationthat contains a viewStack.
> The 
> > > stack defaults to the first canvas. This canvas contains a
> button 
> > > that when pushed, changes the stack to the second canvas.
> > > 
> > > I can get this to work, but what I really want is to put the
> first 
> > > canvas into a second mxml file. The problem that happens is now
> > when
> > > the button is pushed it, the action script doesn't understand 
the
> > id
> > > of the viewStack. The action script is running on the second
> mxml 
> > > file while the viewStack is in the first mxml file.
> > > 
> > > The code is:
> > > function loginButtonPressed() {
> > > headerStack.selectedChild = secondCanvas;
> > > }
> > > 
> > > Flex cannot find headerStack. Is there any way to pass this
> value 
> > > back and forth between the two mxml files?
> > > 
> > > Thank you so much,
> > > Kim
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links





Reply via email to